7
ToggleButton이 있습니다. 명령 바인딩을 사용하고 IsChecked 속성의 값을 매개 변수로 전달하려고합니다. ToggleButton의 이름을 지정하지 않고 이름을 사용하여 자체적으로 처리하지 않으면 어떻게 할 수 있습니까?WPF를 사용하여 명령 바인딩에서 자체 속성 제어
현재 컨트롤의 이름을 지정하여이 문제를 해결하고 있지만 이것이 더 좋은 방법이라고 생각하십니까? 이 도움이
<ToggleButton x:Name="_myToggle"
Command="{Binding SomeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Self},
Path=IsChecked}">
Apply Toggle
</ToggleButton>
희망 :
<ToggleButton x:Name="_myToggle"
Command="{Binding SomeCommand}"
CommandParameter="{Binding ElementName=_myToggle, Path=IsChecked}">
Apply Toggle
</ToggleButton>
물론! 고마워! 전에 해본 적이 있지만, 잠시 동안 완전히 잊어 버렸습니다. – stiank81