Back to Devexpress

AccordionControl.HtmlTemplates Property

windowsforms-devexpress-dot-xtrabars-dot-navigation-dot-accordioncontrol-e8bf1e5f.md

latest7.2 KB
Original Source

AccordionControl.HtmlTemplates Property

Contains HTML-CSS templates used to render the control’s UI elements.

Namespace : DevExpress.XtraBars.Navigation

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

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

Property Value

TypeDescription
AccordionControlHtmlTemplates

An object that contains HTML-CSS templates used to render the control’s UI elements.

|

Remarks

Use HTML-CSS Templates to Render UI Elements

AccordionControl allows you to use your knowledge of HTML and CSS markup to render the control’s UI elements. A template’s HTML markup specifies an element’s contents, while the template’s CSS code specifies style, display, and layout settings applied to the element.

AccordionControl exposes a set of properties (accessible from the AccordionControl.HtmlTemplates object) to specify HTML-CSS templates to render the control’s elements:

Display Element’s Text, Images, and Custom Data

When you specify templates for AccordionControl elements, you can use the data binding syntax (${PropertyName}) to display text, images, and custom values (AccordionControlElementBase.Tag) of these elements.

${Text} — Inserts an element’s text (AccordionControlElementBase.Text).

${Image} — Inserts an element’s image specified in the AccordionControlElementBase.ImageOptions object. Use the img tag to insert an image, for example, as follows: ` <div class="item_layout">

    <div class="item_text">${Text}</div>
</div>
</div> ```

You can also use the ${MyField1} syntax to mark an element as bound to a custom data source. The actual data for this element is set in the QueryHtmlElementData event handler.

html
<div class="acc_item">${MyField1}</div>
csharp
private void OnQueryHtmlElementData(object sender, QueryAccordionHtmlElementDataEventArgs e) {
    if (e.FieldName == "MyField1") {
        e.Value = "CustomData";
    }
}
vb
Private Sub OnQueryHtmlElementData(ByVal sender As Object, ByVal e As QueryAccordionHtmlElementDataEventArgs)
    If e.FieldName = "MyField1" Then
        e.Value = "CustomData"
    End If
End Sub

See Also

AccordionControl Class

AccordionControl Members

DevExpress.XtraBars.Navigation Namespace