wpf 移除listbox默认阴影、选中样式

 <!--移除默认选中的阴影(通过绑定ItemContainerStyle来使用)-->
    <Style x:Key="ListItemNullFocusContainerStyle" TargetType="ListBoxItem">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border Name="Border" Background="Transparent" SnapsToDevicePixels="True">
                        <ContentPresenter />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
posted @ 2021-05-27 20:56  Hey,Coder!  阅读(451)  评论(0编辑  收藏  举报