NavBarGroup.Content Property

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

Namespace: DevExpress.Xpf.NavBar

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

Declaration

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

Property Value

Type Description
Object

An object that specifies the content of the group.

Remarks

If a group's NavBarGroup.DisplaySource property is set to DisplaySource.Content, the Content property is used instead of the NavBarGroup.Items property to define any custom content of the group.

To learn more, see the Group Content Model topic.

Examples

This examples demonstrates how a group can be created programmatically, and its content can be defined using a StackPanel and two TextBlock controls. The second TextBlock displays the text of the selected item within the NavBarControl.

View Example

private void CreateGroup2(NavBarControl navBar){
    NavBarGroup group2 = new NavBarGroup();
    group2.Header = "Custom Content";
    //Specify that the group's content should be defined via the Content property
    group2.DisplaySource = DisplaySource.Content;

    //Create a StackPanel and specify it as the group's content
    StackPanel stackPanel = new StackPanel() { Orientation = Orientation.Horizontal };
    group2.Content = stackPanel;

    //Define the panel's content by creating two text blocks
    stackPanel.Children.Add(new TextBlock() {Text = "Selected Item: "});

    TextBlock textBlock2 = new TextBlock();
    Binding textBlockTextBinding = new Binding("SelectedItem.Content");
    textBlockTextBinding.Source = navBar; //textBlockTextBinding.Source = navBar.Groups[0];
    //The second text block displays the text of the NavBarControl's selected item
    textBlock2.SetBinding(TextBlock.TextProperty, textBlockTextBinding);
    stackPanel.Children.Add(textBlock2);

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