2016-10-10 12 views
0

다음은 wpf 사용자 정의 컨트롤에있는 두 개의 단추입니다. Option 버튼의 클릭 이벤트에서 명령 매개 변수 Wpf에서 다른 단추 전달

<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}"> 

, 내가보기 모델에 CommandParameter로 버튼을 전달하고있다. 동일한 이벤트에 대해 Option 단추 대신 command 매개 변수에 다른 단추 ( validity)를 전달하려면 어떻게합니까?

답변

2

사용 요소 이름 :

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