AlertControl.CustomizeHtmlTemplate Event
Allows you to dynamically customize elements of alert windows rendered from HTML-CSS templates.
Namespace: DevExpress.XtraBars.Alerter
Assembly: DevExpress.XtraBars.v24.2.dll
Declaration
[DXCategory("Events")]
public event CustomizeAlertHtmlTemplateEventHandler CustomizeHtmlTemplate
Event Data
The CustomizeHtmlTemplate event's data class is DevExpress.XtraBars.Alerter.CustomizeAlertHtmlTemplateEventArgs.
Remarks
AlertControl can render alert windows from HTML-CSS templates. Use the HtmlTemplate
property to specify the template. You can also handle the AlertControl.BeforeFormShow event to assign templates to alert windows dynamically.
The CustomizeHtmlTemplate
event fires before a template-based alert window is displayed.
Use the event’s RootInfo
property to access individual HTML elements of the currently processed alert window. The following methods allow you to retrieve HTML elements by tag, class, and ID:
RootInfo.FindElementsByTag
— Returns a list of HTML elements that have the specified tag.RootInfo.FindElementsByClass
— Returns a list of HTML elements that are of the specified class.RootInfo.FindElementById
— Returns an HTML element with the specified ID.
The elements returned by these methods expose properties to change element display settings. The main properties include:
- element.
Hidden
— Allows you to hide the element. - element.
Style
— Allows you to modify CSS style properties applied to the element. This object exposes theSetBackgroundColor
,SetForeColor
, andSetProperty
methods for this purpose.
private void alertControl1_CustomizeHtmlTemplate(object sender, DevExpress.XtraBars.Alerter.CustomizeAlertHtmlTemplateEventArgs e) {
//...
var photo = e.RootInfo.FindElementById("photo");
if (photo != null) photo.Hidden = true;
}