CanExecuteRoutedEventArgs.Parameter Property


Gets the command specific data.

 property System::Object ^ Parameter { System::Object ^ get(); };
public object Parameter { get; }
member this.Parameter : obj
Public ReadOnly Property Parameter As Object

Property Value

The command data. The default value is null.


The following example shows up to use a Button as the command source for a custom command. The Command property of the Button is set to the custom RoutedCommand called customCommand and the CommandParameter is used to pass the value of the Value property of a Slider control. This is accomplishment by using databinding to bind the CommandParameter to the Value property. The converter in the binding expression is a custom IValueConverter which converts Value into an Int32 before binding it to the CommandParameter.

<!-- The Command Source for the custom command-->
<!-- Passes Slider.Value as the CommandParameter-->
<Button Command="{x:Static custom:Window1.customCommand}" 
        CommandParameter="{Binding ElementName=secondSlider,
                            Converter={StaticResource ValueConverterResource}}" 


The command parameter is used to pass specific information to the command when it is executed. The type of the data is defined by the command.

Parameter can be null. Many commands do not process or expect command parameters.

Applies to

See also