Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to command bind toggle button as control template
    primarykey
    data
    text
    <p>Here is the code :</p> <pre><code> &lt;Window.DataContext&gt; &lt;local:MainWindowViewModel /&gt; &lt;/Window.DataContext&gt; &lt;Window.Resources&gt; &lt;Style x:Key="RadioToggleButtonStyle" TargetType="RadioButton"&gt; &lt;Setter Property="SnapsToDevicePixels" Value="true" /&gt; &lt;Setter Property="OverridesDefaultStyle" Value="true" /&gt; &lt;Setter Property="Background" Value="Transparent" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type RadioButton}"&gt; &lt;ToggleButton Content="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" IsChecked="{Binding IsChecked, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" /&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Setter Property="Width" Value="150" /&gt; &lt;Setter Property="Height" Value="25" /&gt; &lt;Setter Property="VerticalAlignment" Value="Center" /&gt; &lt;/Style&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;RadioButton Name="radioButton1" Height="29" Margin="193,195,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" **Command="{Binding Path=RadioClickCommand}"** Content="RadioButton" Style="{StaticResource RadioToggleButtonStyle}" /&gt; &lt;/Grid&gt; </code></pre> <p></p> <p>In MainWindowViewModel : I have following command registration</p> <pre><code> public ICommand RadioClickCommand { get { return new RelayCommand(RadioClickExecute); } } private void RadioClickExecute() { } </code></pre> <p>Button click never triggers the command bind. any help would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload