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

NavBarGroup.DisplaySource Property

Gets or sets a value that specifies which property (NavBarGroup.Items or NavBarGroup.Content) defines the group’s content. This is a dependency property.

Namespace: DevExpress.Xpf.NavBar

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

Declaration

public DisplaySource DisplaySource { get; set; }

Property Value

Type Description
DisplaySource

One of the DisplaySource enumeration values.

Available values:

Name Description
Items

Specifies that group content is represented by the NavBarGroup.Items property.

Content

Specifies that group content is represented by the NavBarGroup.Content property.

Remarks

Use the DisplaySource property to control whether the group’s content is represented by items from the NavBarGroup.Items collection or by a custom content defined via the NavBarGroup.Content property. By default, the NavBarGroup.Items property is used to represent group contents.

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 DisplaySource 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