简体   繁体   English

如何在WPF的ListView中将列标题抓取器添加到列标题的自定义样式?

[英]How to add column header gripper to a custom style of column header in ListView in WPF?

So, this is my style. 所以,这是我的风格。 How I can add a gripper to it? 我如何向其中添加抓具? I did not find a way to do it :с 我没有找到解决方法:с

<Style x:Key="CustomHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="FontFamily" Value="Segoe UI" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                    <Border BorderThickness="1,1,1,1" BorderBrush="{DynamicResource AccentBrushWithLowOpacity}" Background="Transparent">
                        <TextBlock x:Name="ContentHeader" Text="{TemplateBinding Content}" Width="{TemplateBinding Width}" TextAlignment="Center" />
                    </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

You edited them out yourself my friend. 你自己把它们编辑掉了,我的朋友。

You can find the default Style and Template here: 您可以在此处找到默认的样式和模板:

https://msdn.microsoft.com/en-us/library/ff506248(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/ff506248(v=vs.110).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM