NavBarGroup.Header Property

Gets or sets the content of the group's header. This is a dependency property.

Namespace: DevExpress.Xpf.NavBar

Assembly: DevExpress.Xpf.NavBar.v20.2.dll

Declaration

public object Header { get; set; }
Public Property Header As Object

Property Value

Type Description
Object

The object to use for the group header.

Remarks

You can set the Header property to a string or any other object. In the latter case, you can provide a template to render this object via the NavBarGroup.HeaderTemplate and NavBarGroup.HeaderTemplateSelector or the NavBarViewBase.HeaderTemplate and NavBarViewBase.HeaderTemplateSelector properties.

To learn more, see the Group Content Model topic.

Examples

This example demonstrates how items can be created and customized programmatically within a navbar group.

In this sample, images are defined for the group header and the third group item via the NavBarGroup.ImageSource and NavBarItem.ImageSource properties, respectively. The item image's layout is customized by assigning the item's NavBarItem.VisualStyle property with a specific style that makes use of the NavBarViewBase.LayoutSettings attached property's LayoutSettings.ImageDocking setting.

View Example

private void CreateGroup1(NavBarControl navBar){
    NavBarGroup group1 = new NavBarGroup();
    group1.Header = "Items";
    //Display an image within the group's header
    group1.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/folder.png"));

    NavBarItem item1 = new NavBarItem();
    item1.Content = "Home";
    group1.Items.Add(item1);

    NavBarItem item2 = new NavBarItem();
    item2.Content = "Work";
    group1.Items.Add(item2);

    NavBarItem item3 = new NavBarItem();
    item3.Content = "Private";
    //Display an image within the item
    item3.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/private.png"));
    //Change item image layout
    Style itemStyle = new Style();
    itemStyle.Setters.Add(new Setter(NavBarViewBase.LayoutSettingsProperty, new LayoutSettings() { ImageDocking = Dock.Right }));
    item3.VisualStyle = itemStyle;
    group1.Items.Add(item3);

    navBar.Groups.Add(group1);
}
See Also