Skip to main content
A newer version of this page is available. .

NavBarGroup.Content Property

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

Namespace: DevExpress.Xpf.NavBar

Assembly: DevExpress.Xpf.NavBar.v19.1.dll

Declaration

public object Content { get; set; }

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.

Example

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.

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);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the Content property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also