wpf-devexpress-dot-mvvm-dot-ui-dot-compositecommandbehavior-d517791a.md
Gets or sets the name of the associated control‘s ICommand property. This is a dependency property.
Namespace : DevExpress.Mvvm.UI
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
public string CommandPropertyName { get; set; }
Public Property CommandPropertyName As String
| Type | Default | Description |
|---|---|---|
| String | Command |
The name of the ICommand property.
|
If the associated control does not have a Command property, assign the CommandPropertyName property to the name of an ICommand property. The behavior binds its CompositeCommand to the specified property.
The following code sample executes a CompositeCommand when a user clicks the ThemedWindow‘s back button:
<dx:ThemedWindow ...
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:ViewModels="clr-namespace:CompositeCommandCommandPropertyName.ViewModels"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
ShowBackButton="True">
<dx:ThemedWindow.DataContext>
<ViewModels:MainViewModel/>
</dx:ThemedWindow.DataContext>
<dxmvvm:Interaction.Behaviors>
<dxmvvm:CompositeCommandBehavior CommandPropertyName="NavigateBackCommand">
<dxmvvm:CommandItem Command="{Binding SaveCommand}"/>
<dxmvvm:CommandItem Command="{Binding CloseCommand}"/>
</dxmvvm:CompositeCommandBehavior>
</dxmvvm:Interaction.Behaviors>
<!-- ... -->
</dx:ThemedWindow>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using System.Windows;
public partial class MainViewModel : ViewModelBase {
[Command]
public void Save()
{
// ...
}
[Command]
public void Close()
{
// ...
}
}
Imports DevExpress.Mvvm
Imports DevExpress.Mvvm.DataAnnotations
Imports System.Windows
Public Partial Class MainViewModel
Inherits ViewModelBase
<Command>
Public Sub Save()
' ...
End Sub
<Command>
Public Sub Close()
' ...
End Sub
End Class
See Also
CompositeCommandBehavior Class