wpf-devexpress-dot-mvvm-dot-ui-dot-confirmationbehavior-dfbaf1e9.md
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.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 property that should invoke the confirmation message box.
|
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() {
// ...
}
}
Imports DevExpress.Mvvm
Imports DevExpress.Mvvm.DataAnnotations
Public Class MainViewModel
Inherits ViewModelBase
<Command>
Public Sub Close()
End Sub
End Class
See Also