Back to Devexpress

AlertControl.HtmlTemplates Property

windowsforms-devexpress-dot-xtrabars-dot-alerter-dot-alertcontrol-3fecba12.md

latest3.1 KB
Original Source

AlertControl.HtmlTemplates Property

Gets the collection of HTML-CSS templates.

Namespace : DevExpress.XtraBars.Alerter

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Layout")]
public HtmlTemplateCollection HtmlTemplates { get; }
vb
<DXCategory("Layout")>
Public ReadOnly Property HtmlTemplates As HtmlTemplateCollection

Property Value

TypeDescription
HtmlTemplateCollection

The collection of HTML-CSS templates.

|

Remarks

AlertControl can render alert windows from HTML-CSS templates. Use the AlertControl.HtmlTemplate property to specify the default template.

The HtmlTemplates collection allows you to create multiple templates beforehand. You can handle the AlertControl.BeforeFormShow event to assign templates from this collection to alert windows dynamically.

csharp
private void alertControl1_BeforeFormShow(object sender, DevExpress.XtraBars.Alerter.AlertFormEventArgs e) {
    AlertControl alertControl = sender as AlertControl;
    if (e.HtmlPopup.AlertInfo.Tag != null)
        e.HtmlPopup.HtmlTemplate.Assign(alertControl.HtmlTemplates[1]);
}
vb
Private Sub AlertControl1_BeforeFormShow(sender As Object, e As DevExpress.XtraBars.Alerter.AlertFormEventArgs) Handles AlertControl1.BeforeFormShow
    Dim alertControl As AlertControl = TryCast(sender, AlertControl)
    If e.HtmlPopup.AlertInfo.Tag IsNot Nothing Then
        e.HtmlPopup.HtmlTemplate.Assign(alertControl.HtmlTemplates(1))
    End If
End Sub

See the following topic for more information: Alert Windows with HTML Templates.

See Also

HtmlTemplate

CustomizeHtmlTemplate

BeforeFormShow

Alert Windows with HTML Templates

AlertControl Class

AlertControl Members

DevExpress.XtraBars.Alerter Namespace