wpf listbox中的item项被选中时,更改选中效果 并隐藏选中虚线。
listbox代码如下<GridName="deskGrid"Background="Gray"Margin="0,0,20,0"><ScrollViewer><List...
listbox代码如下<Grid Name="deskGrid" Background="Gray" Margin="0,0,20,0"><ScrollViewer><ListBox Name="itemsControl" SelectionMode="Extended" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemTemplate="{StaticResource view}" SelectionChanged="itemsControl_SelectionChanged" Focusable="False"><ListBox.Template ><ControlTemplate TargetType="{x:Type ListBox}" ><WrapPanel IsItemsHost="True" HorizontalAlignment="Center" /></ControlTemplate></ListBox.Template></ListBox></ScrollViewer></Grid>
展开
2个回答
展开全部
<Window.Resources>
<Style TargetType="ListBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
</Style>
<Style TargetType="ListBoxItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightGray"></SolidColorBrush>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightGray"></SolidColorBrush>
</Style.Resources>
</Style>
</Window.Resources>
<Style TargetType="ListBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
</Style>
<Style TargetType="ListBoxItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightGray"></SolidColorBrush>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightGray"></SolidColorBrush>
</Style.Resources>
</Style>
</Window.Resources>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询