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?

1 Answer 1

3

Use element name:

<Button x:Name="Option"  VerticalAlignment="Center" 
    Command="{Binding Path=OptionsButtonClickCommand}" CommandParameter="{Binding ElementName=validity}">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.