Back to Devexpress

HtmlTemplateCollection Class

windowsforms-devexpress-dot-utils-dot-html-ea570426.md

latest4.5 KB
Original Source

HtmlTemplateCollection Class

The collection of HTML templates that can be used as an external template storage by other controls.

Namespace : DevExpress.Utils.Html

Assembly : DevExpress.Utils.v25.2.dll

NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core

Declaration

csharp
public class HtmlTemplateCollection :
    Collection<HtmlTemplate>,
    IBindingList,
    IList,
    ICollection,
    IEnumerable,
    IComponent,
    IDisposable
vb
Public Class HtmlTemplateCollection
    Inherits Collection(Of HtmlTemplate)
    Implements IBindingList,
               IList,
               ICollection,
               IEnumerable,
               IComponent,
               IDisposable

The following members return HtmlTemplateCollection objects:

Remarks

Click the “Edit Collection” action on the HtmlTemplateCollection component’s smart tag menu to invoke the template editor. You can use the selector above the Preview panel to preview different objects with the current template applied. If you create a new template and use this selector to preview an object that uses unique tags (for example, the DirectXForm that uses the dx-form-frame, dx-form-titlebar, dx-form-maximizebutton, and other unique tags), the HtmlTemplateCollection displays the default template for this object.

Templates added to this collection can be used by other controls, for example HtmlContentControl:

csharp
// Use the third template of the collection inside "htmlContentControl1"
htmlContentControl1.HtmlTemplate.Assign(htmlTemplateCollection1[2]);
vb
' Use the third template of the collection inside "htmlContentControl1"
htmlContentControl1.HtmlTemplate.Assign(htmlTemplateCollection1(2))

This technique is especially useful when you cannot create templates at design time. For example, an XtraMessageBox template must be assigned to an XtraMessageBoxArgs object that can be accessed only in code.

csharp
// Use the "Win11MessageTemplate" to display custom messages
XtraMessageBoxArgs args = new XtraMessageBoxArgs();
args.HtmlTemplate.Assign(htmlTemplateCollection1.First(
    x => x.Name == "Win11MessageTemplate"));
XtraMessageBox.Show(args);
vb
' Use the "Win11MessageTemplate" to display custom messages
Dim args As XtraMessageBoxArgs = New XtraMessageBoxArgs()
args.HtmlTemplate.Assign(htmlTemplateCollection1.First(Function(x) x.Name = "Win11MessageTemplate"))
XtraMessageBox.Show(args)

Inheritance

Object Collection<HtmlTemplate> HtmlTemplateCollection

See Also

HtmlTemplateCollection Members

DevExpress.Utils.Html Namespace