Back to Devexpress

AccordionControlHtmlTemplates.FooterElement Property

windowsforms-devexpress-dot-xtrabars-dot-navigation-dot-accordioncontrolhtmltemplates-86092a8a.md

latest5.7 KB
Original Source

AccordionControlHtmlTemplates.FooterElement Property

Specifies the default HTML-CSS template used to render elements when they are displayed within the control’s footer.

Namespace : DevExpress.XtraBars.Navigation

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

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

Property Value

TypeDescription
HtmlTemplate

The HTML-CSS template used to render items in the control’s footer.

|

Remarks

AccordionControl can render its UI elements from HTML-CSS templates. The following properties allow you to define HTML templates for the footer panel and its elements:

HTML markup for the HtmlFooterElementTemplate template should contain an HTML element with the predefined “dx-item” identifier (id). This element’s size determines the footer item’s display size.

The following example shows a template for the HtmlFooterElementTemplate property. The HTML code uses the “dx-item” id to mark the HTML element that determines the display size of footer items:

html
<div class="container">
    <div id="dx-item" class="dx-item">
        
        <div class="highlight"></div>
    </div>
</div>
css
.dx-item-class {
    border-radius: 3px;
    padding: 7px 7px 3px 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1px;
}

.item_image {
    width: 32px;
    height: 32px;
}

You can also specify different templates for different elements (items and groups). For this purpose, use the HtmlTemplateCollection collection to create templates beforehand. Then, handle the AccordionControl.QueryItemTemplate event to supply templates to elements dynamically.

Display an 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

AccordionControlHtmlTemplates Class

AccordionControlHtmlTemplates Members

DevExpress.XtraBars.Navigation Namespace