Is there any way that I change a Label's behavior to support toggling by click in WPF?
i.e. that's Selector.IsSelected
property toggle between "True" and "False" by clicking?
Regards.
<StackPanel>
<CheckBox IsChecked="{Binding IsChecked, ElementName=checkbox}" Content="Hello">
<CheckBox.Template>
<ControlTemplate TargetType="CheckBox">
<ContentPresenter/>
</ControlTemplate>
</CheckBox.Template>
</CheckBox>
<CheckBox x:Name="checkbox" Content="A normal checkbox"/>
</StackPanel>
Note that the above template does not alter the appearance of the label based on whether it's checked or not. That might be something you'll need - hard to say without more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With