Skip to main content

NavBarViewBase.GetNavBarGroup(RoutedEventArgs) Method

Gets a group related to the event whose data is passed via the method’s parameter.

Namespace: DevExpress.Xpf.NavBar

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

NuGet Package: DevExpress.Wpf.NavBar

Declaration

public NavBarGroup GetNavBarGroup(
    RoutedEventArgs e
)

Parameters

Name Type Description
e RoutedEventArgs

A RoutedEventArgs descendant specifying the routed event.

Returns

Type Description
NavBarGroup

A NavBarGroup object representing the group related to the specified event. If no group relates to the event, null (Nothing in Visual Basic) is returned.

Remarks

When an end-user performs any actions within a view (such as clicks or hovers the view, etc), responding to these actions may be required, to determine the underlying group or item that corresponds to the event generated by the action. Use the GetNavBarGroup method to obtain a group relating to the event that is described by the passed event argument.

//...
using DevExpress.Xpf.NavBar;
//...
        public Window1(){
            InitializeComponent();

            navBar.View.Click += new RoutedEventHandler(View_Click);
        }

        void View_Click(object sender, RoutedEventArgs e){
            NavBarGroup group = navBar.View.GetNavBarGroup(e);
            NavBarItem item = navBar.View.GetNavBarItem(e);
            if (group != null || item != null)
                MessageBox.Show("Click - " + (item != null ? "Item: " + item.Content : "Group: " + group.Header));
        }

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetNavBarGroup(RoutedEventArgs) method.

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