【发布时间】:2016-11-16 01:22:46
【问题描述】:
似乎是当单选按钮没有聚焦时然后得到这个白色方块
RB 的样式:
<TextBlock Margin="0,0,0,0" Foreground="#FF3E3E3E" FontFamily="Calibri" FontSize="12">
<ContentPresenter />
</TextBlock>
</BulletDecorator>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="RadioMark" Property="Visibility" Value="Visible"/>
<Setter TargetName="RadioOuter" Property="BorderBrush" Value="Yellow" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
列表框:
<ListBox Background="Transparent" BorderThickness="0" ItemsSource="{Binding WhatsNewList}" SelectedItem="{Binding SelectedItem}">
<ListBox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
</ListBox.Resources>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center"
HorizontalAlignment="Center">
</StackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type local:ExampleClass}">
<RadioButton GroupName="Properties" Background="Transparent">
<RadioButton.IsChecked>
<Binding Path="IsSelected"
RelativeSource="{RelativeSource AncestorType=ListBoxItem}"
Mode="TwoWay" />
</RadioButton.IsChecked>
</RadioButton>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
我有一个按钮,可以在列表框中以编程方式更改“SelectedItem”。但是,当我单击按钮时,它会更新选择,但不想要的副作用是我的单选按钮选择后面的白色方框。如何删除它?
【问题讨论】:
标签: wpf radio-button .net-4.5