Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
0 out of 1 rated this helpful - Rate this topic

ButtonBase.CommandParameter Property

Gets or sets the parameter to pass to the Command property.

Namespace:  System.Windows.Controls.Primitives
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
[BindableAttribute(true)]
[LocalizabilityAttribute(LocalizationCategory.NeverLocalize)]
public Object CommandParameter { get; set; }
<object>
  <object.CommandParameter>
    <Object .../>
  </object.CommandParameter>
</object>
<object CommandParameter="commandParameter" />

XAML Values

commandParameter

A value of the same type as the particular command specified in the Command property expects. If you use an existing command library command, see that command library's documentation for XAML usage information, including which type of CommandParameter the command expects. If you use a custom command, see Remarks.

Property Value

Type: System.Object
Parameter to pass to the Command property.

Implements

ICommandSource.CommandParameter

Identifier field

CommandParameterProperty

Metadata properties set to true

None

Most existing commands from the command libraries do not use a command parameter. Of the commands that do use a command parameter, most of these take a parameter with some primitive type value, such as an integer or a string. However, it is possible to create a custom command where that command expects a nonprimitive type as its command parameter. For a custom command case like this, setting CommandParameter in code might require a new or existing object instance. Setting CommandParameter in markup might require property element syntax, where the object element filling the property element syntax is a new element of the type expected by that command. Alternatively, setting in markup might require a reference through a markup extension to an existing object (typically these references are made with Binding Markup Extension or StaticResource Markup Extension).

.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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.