Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ConfirmationBehavior.Command Property

Gets or sets the command that runs if the user accepts the confirmation message. This is a dependency property.

Namespace: DevExpress.Mvvm.UI

Assembly: DevExpress.Xpf.Core.v24.2.dll

NuGet Package: DevExpress.Wpf.Core

#Declaration

public ICommand Command { get; set; }

#Property Value

Type Default Description
ICommand null

The associated control’s Command property.

#Remarks

The following code sample attaches a command to a Button and enables a confirmation message for this command:

<Button Content="Close">
    <dxmvvm:Interaction.Behaviors>
        <dxmvvm:ConfirmationBehavior EnableConfirmationMessage="{Binding IsSaved, Converter={StaticResource BooleanNegationConverter}}" 
                                     Command="{Binding CloseCommand}" MessageText="The document has unsaved changes. Do you want to close the document?"/>
    </dxmvvm:Interaction.Behaviors>
</Button>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
// ...
    public class MainViewModel : ViewModelBase {
    // ...
        [Command]
        public void Close() {
        // ...
        }
    }

If a control does not have a Command property, you can use the CommandPropertyName property to attach the behavior to the command.

See Also