Skip to main content

NavBarItem.Command Property

Gets or sets the command to invoke when the NavBar item is clicked.

Namespace: DevExpress.Xpf.NavBar

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

NuGet Package: DevExpress.Wpf.NavBar


public ICommand Command { get; set; }

Property Value

Type Description

An ICommand object to invoke when the NavBar item is clicked.


If a NavBarItem was selected via a click at runtime, a Command is executed and the NavBarItem.Select and NavBarItem.Click events fire. If an end-user clicks an already selected item, the NavBarItem.Select event is skipped.

The Command can receive additional custom parameters (specified via the NavBarItem.CommandParameter) and a target object on which the command is executed (specified via the NavBarItem.CommandTarget).

The code below illustrates an example of defining a command:

    <CommandBinding Command="{x:Static custom:MainWindow.myCommand}"
namespace myApplicationNamespace {
    public partial class MainWindow : Window {
        public static RoutedCommand myCommand = new RoutedCommand();
        public MainWindow() {
        private void myCommandExecuted(object sender, ExecutedRoutedEventArgs e) {
            //Actions to perform
            . . .
        private void myCommandExecute(object sender, CanExecuteRoutedEventArgs e) {
            //Case of command's availability
            if (. . .) {
                e.CanExecute = true; }

To use the command as the user clicks a NavBarItem, assign it to the Command property of this group as in the following code:

<dxn:NavBarGroup Content="My Group" Name="navBarGroup1" Command="{x:Static custom:MainWindow.myCommand}" />

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Command property.


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