wpf-devexpress-dot-xpf-dot-navbar-dot-navbarviewbase-dot-getnavbaritem-x28-system-dot-windows-dot-routedeventargs-x29.md
Gets an item related to the event whose data is passed via the method’s parameter.
Namespace : DevExpress.Xpf.NavBar
Assembly : DevExpress.Xpf.NavBar.v25.2.dll
NuGet Package : DevExpress.Wpf.NavBar
public NavBarItem GetNavBarItem(
RoutedEventArgs e
)
Public Function GetNavBarItem(
e As RoutedEventArgs
) As NavBarItem
| Name | Type | Description |
|---|---|---|
| e | RoutedEventArgs |
A RoutedEventArgs descendant specifying the routed event.
|
| Type | Description |
|---|---|
| NavBarItem |
A NavBarItem object representing the item related to the specified event. If no item relates to the event, null ( Nothing in Visual Basic) is returned.
|
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 GetNavBarItem method to obtain an item 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 snippets (auto-collected from DevExpress Examples) contain references to the GetNavBarItem(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.
{
NavBarItem item = ((NavBarViewBase)sender).GetNavBarItem(e);
if (item != null)
wpf-spreadsheetcontrol-api-part-1/CS/SpreadsheetControl_WPF_API/MainWindow.xaml.cs#L41
NavBarGroup group = ((NavBarViewBase)sender).GetNavBarGroup(e);
NavBarItem item = ((NavBarViewBase)sender).GetNavBarItem(e);
if (item == null) return;
wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/MainWindow.xaml.cs#L30
{
NavBarItem item = ((NavBarViewBase)sender).GetNavBarItem(e);
if (item != null)
Private Sub NavigationPaneView_MouseDoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
Dim item As NavBarItem = DirectCast(sender, NavBarViewBase).GetNavBarItem(e)
If item IsNot Nothing Then
wpf-spreadsheetcontrol-api-part-1/VB/SpreadsheetControl_WPF_API/MainWindow.xaml.vb#L39
Dim group As NavBarGroup = DirectCast(sender, NavBarViewBase).GetNavBarGroup(e)
Dim item As NavBarItem = DirectCast(sender, NavBarViewBase).GetNavBarItem(e)
If item Is Nothing Then
wpf-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_WPF_API_Part02/MainWindow.xaml.vb#L28
Private Sub NavigationPaneView_MouseDoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
Dim item As NavBarItem = DirectCast(sender, NavBarViewBase).GetNavBarItem(e)
If item IsNot Nothing Then
See Also