I’m trying to bind the checkbox checkchange event to a command – MVVM
Why doesn’t this work? or do anything while the same works on button?
<CheckBox x:Name="radRefresh" IsChecked="{BindingREADY, Mode=TwoWay}" Command="{Binding Refresh_Command}" Content=" Refresh " Margin="10,25,0,0" />
<Button Command="{Binding Refresh_Command}" />
thanks
This will work…
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<cmd:EventToCommand Command="{Binding Path=YourCommand,Mode=OneWay}" CommandParameter="{Binding IsChecked, ElementName=YourCheckBox}"></cmd:EventToCommand>
</i:EventTrigger>
</i:Interaction.Triggers>
where i is
Add namespace for cmd
This is one of the preferred ways for MVVM if you are utilizing the MVVMLight Framework.