I try to set up images instead of bullet for my RadioButtons. I've 10 RadioButtons but I can't setup my FishImg for all. Only the rb I clicked just before displays the imgFish.
My Style
<Style TargetType="RadioButton">
<Setter Property="Content" Value="{DynamicResource imgFish}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid>
<Image Source="Images/empty.png" Width="24" Height="24" />
<ContentPresenter/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="{DynamicResource imgHero}"/>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter Property="Content" Value="{DynamicResource imgFish}"/>
</Trigger>
</Style.Triggers>
</Style>
My XAML
<RadioButton Grid.Column="2" Grid.Row="1" Name="hvP1" />
<RadioButton Grid.Column="2" Grid.Row="2" Name="hvP2" />
<RadioButton Grid.Column="2" Grid.Row="3" Name="hvP3" />
<RadioButton Grid.Column="2" Grid.Row="4" Name="hvP4" />
<RadioButton Grid.Column="2" Grid.Row="5" Name="hvP5" />
<RadioButton Grid.Column="2" Grid.Row="6" Name="hvP6" />
<RadioButton Grid.Column="2" Grid.Row="7" Name="hvP7" />
<RadioButton Grid.Column="2" Grid.Row="8" Name="hvP8" />
<RadioButton Grid.Column="2" Grid.Row="9" Name="hvP9" />
<RadioButton Grid.Column="2" Grid.Row="10" Name="hvP10" />
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…