sa_*_*213 8 c# wpf listbox windows-8
我收到的投诉从Windows8用户有关围绕一个奇怪的框架SelectedItem上ListBoxes
在Windows7这个问题不存在,到目前为止,我发现没有办法摆脱这个白框.
据我所知,Windows8列表框现在使用ControlBrushKey而不是HighlightBrushKey设置为Transparent没有影响.
我目前没有Windows8开发环境,所以我尝试的所有修复都是纯粹的猜测工作.
ListBox资源:
<ListBox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="Transparent" />
<Style TargetType="ListBoxItem">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
</ListBox.Resources>
Run Code Online (Sandbox Code Playgroud)
整个Xaml可以在这里找到:https://github.com/saddam213/MPDisplay/blob/master/GUIFramework/GUI/Controls/GUIList.xaml
框架图片:(选择周围的白框)

如果有人知道如何摆脱这一点,那就太棒了.
我想这可能对你有帮助。使用 isSelected 的 Trigger 属性。
<ListBox Name="lst">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True" >
<Setter Property="BorderBrush" Value="Wheat"/>
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1460 次 |
| 最近记录: |