This documentation is archived and is not being maintained.

CanExecuteRoutedEventArgs.Parameter Property

Gets the command specific data.

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public Object Parameter { get; }

Property Value

Type: System.Object
The command data. The default value is null.

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.

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 customComandand 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}" 
        Content="Command"
        CommandParameter="{Binding ElementName=secondSlider,
                            Path=Value,
                            Converter={StaticResource ValueConverterResource}}" 
        Margin="10"/>


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: