ConfirmationBehavior.CommandPropertyName Property
Gets or sets a name of an associated control’s command property. This is a dependency property.
Namespace: DevExpress.Mvvm.UI
Assembly: DevExpress.Xpf.Core.v24.1.dll
NuGet Package: DevExpress.Wpf.Core
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | Command | The name of the property that should invoke the confirmation message box. |
Remarks
Note that many controls have a Command property. If the command should trigger ConfirmationBehavior, then you do not need to specify CommandPropertyName.
When a user triggers a command you specified in CommandPropertyName, the control first displays a confirmation message. If a user confirms the operation, the ConfirmationBehavior executes the command specified by the Command property.
The following code sample specifies the CommandPropertyName property and enables a confirmation message when a user clicks the ThemedWindow‘s back button. If a user confirms the operation, the ConfirmationBehavior executes the Close command:
<dx:ThemedWindow ...
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm">
<dx:ThemedWindow.DataContext>
<ViewModels:MainViewModel/>
</dx:ThemedWindow.DataContext>
<dxmvvm:Interaction.Behaviors>
<dxmvvm:ConfirmationBehavior Command="{Binding CloseCommand}"
MessageText="Do you want to navigate back?" CommandPropertyName="NavigateBackCommand">
</dxmvvm:ConfirmationBehavior>
</dxmvvm:Interaction.Behaviors>
<!-- ... -->
</dx:ThemedWindow>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
public class MainViewModel : ViewModelBase {
[Command]
public void Close() {
// ...
}
}