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.v20.2.dll

Declaration

public DisplaySource DisplaySource { get; set; }
Public Property DisplaySource As DisplaySource

Property Value

Type Description
DisplaySource

One of the DisplaySource enumeration values.

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.

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