1

Suppose, the followings are two buttons resides in a wpf user control.

<Button x:Name="Option"  VerticalAlignment="Center" 
        Command="{Binding Path=OptionsButtonClickCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}">

<Button x:Name="validity"  UseLayoutRounding="true"
            Command="{Binding Path=ValidityButtonClickCommand}">

In the click event of Option button, I am passing the button as CommandParameter in the view model. How can I pass the other(validity) button in the commandparameter rather than the Option button for the same event?

lukai
  • 536
  • 1
  • 5
  • 20

1 Answers1

3

Use element name:

<Button x:Name="Option"  VerticalAlignment="Center" 
    Command="{Binding Path=OptionsButtonClickCommand}" CommandParameter="{Binding ElementName=validity}">
Rom
  • 1,183
  • 1
  • 8
  • 18