NavBarGroup.HeaderTemplateCollapsed Property
Gets or sets a template used for displaying the content of the group’s header when the group is in a collapsed state.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
#Property Value
Type | Default | Description |
---|---|---|
ITemplate | null | An object supporting the System. |
#Remarks
Use the HeaderTemplateCollapsed property to control the contents of the header for the collapsed state of the current group. The template defined using this property replaces the content of the group header (in particular, the image and text associated with the header) when the group is collapsed.
Note that any style settings defined for the header via the specific properties (such as the ASPxNavBar.GroupHeaderStyleCollapsed or NavBarGroup.HeaderStyleCollapsed) are still in effect for the collapsed group’s header, whose content is specified through using the HeaderTemplateCollapsed property.
In order to define a common content for all headers of the collapsed groups within a navbar control, the navbar’s ASPxNavBar.GroupHeaderTemplateCollapsed property can be used.
Note
Once a template defined via the Header
Note
If you defined the Header
#Example
This example demonstrates how to modify the ASPxNavBar‘s group header content.
using DevExpress.Web.ASPxNavBar;
...
protected void Page_Load(object sender, EventArgs e) {
NavBarGroup group1 = new NavBarGroup("group1", "group1");
NavBarItem item1 = new NavBarItem("item1", "item1");
ASPxNavBar1.Groups.Add(group1);
group1.Items.Add(item1);
group1.HeaderTemplate = new MyTemplate();
group1.HeaderTemplateCollapsed = new MyTemplate1();
}
public class MyTemplate : ITemplate {
void ITemplate.InstantiateIn(Control container) {
Label label = new Label();
label.Text = "The group is expanded";
container.Controls.Add(label);
}
}
public class MyTemplate1 : ITemplate {
void ITemplate.InstantiateIn(Control container) {
Label label2 = new Label();
label2.Text = "The group is collapsed";
container.Controls.Add(label2);
}
}