【发布时间】:2014-09-23 19:18:52
【问题描述】:
我有这个代码:
<GroupBox Grid.Column="1" BorderThickness="0,0,0,0" HorizontalAlignment="Right">
<ItemsControl FontWeight="Normal"
ItemsSource="{Binding Path=AvailableTipologieDifficolta}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton
Content="{Binding Path=DisplayName}"
IsChecked="{Binding Path=IsSelected}"
GroupName="Feedback"
Margin="10,3.5"
Style="{StaticResource RadioButtonTemplate}"
/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GroupBox>
这是 RadioButton 的样式:
<Style TargetType="RadioButton" x:Key="RadioButtonTemplate">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<RadioButton Foreground="White" FontSize="20">
<ContentPresenter/>
</RadioButton>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
所以当我尝试运行我的代码时,我有这个:
o 选项 1 o Opzione 2
我可以选择每个选项,但这是不可能的。如果我删除此代码 Style="{StaticResource RadioButtonTemplate}" 我可以选择一个选项。
我们能帮帮我吗?
【问题讨论】:
-
我们能帮帮我吗?...用文字来解释你的问题和你想要的结果。
标签: c# wpf radio-button