Skip to main content
A newer version of this page is available. .

DXCommand

The DXCommand allows you to bind a command property with methods and functions.

<Button Content="OK" Command="{DXCommand Execute='Save(); Close()', CanExecute='CanSave() and CanClose()'}"/>

The Execute and CanExecute expressions are specified with a special language that is described in the following topic: Language Specification.

You can pass any parameters to calling methods and functions.

<TextBlock x:Name="tb" Text="text"/>
<Button Content="OK" Command="{DXCommand Execute='Save(@e(tb).Text)', CanExecute='CanSave(@e(tb).Text)'}"/>

To access the CommandParameter value, use the @parameter reserved word.

<TextBlock x:Name="tb" Text="text"/>
<Button Content="OK" Command="{DXCommand Execute='Save(@parameter)', CanExecute='CanSave(@parameter)'}" CommandParameter="{DXBinding @e(tb).Text}"/>

The DXCommand extension supports the “=“ operator.

<Button Command="{DXCommand '@e(checkBox).IsChecked=true'}"/>