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.v24.2.dll
Declaration
public class HtmlTemplateCollection :
Collection<HtmlTemplate>,
IBindingList,
IList,
ICollection,
IEnumerable,
IComponent,
IDisposable
Related API Members
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:
// 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.
// Use the "Win11MessageTemplate" to display custom messages
XtraMessageBoxArgs args = new XtraMessageBoxArgs();
args.HtmlTemplate.Assign(htmlTemplateCollection1.First(
x => x.Name == "Win11MessageTemplate"));
XtraMessageBox.Show(args);