I need to change the IsChecked property of a Radio Button on the click of a simple Button in XAML using ChangePropertyAction.
I am able to change every property of the radio button (Content, Visibility etc) through this method except IsChecked and it gives a unnamed error.
<Button x:Name="button1">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=radio1}" PropertyName="IsChecked" Value="false"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</Button>
May I know the reason and the solution please? Thanks.
The problem seems due to this, checkbox ischecked property is inherit from its base class ToggleButton. And it's value is Nullable(See details from this doc). And that's why it reports exception like the following:
To solve this problem, try create a converter yourself:
Then on your XAML, try the following: