簡體   English   中英

如何在WPF的ListView中將列標題抓取器添加到列標題的自定義樣式?

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

所以,這是我的風格。 我如何向其中添加抓具? 我沒有找到解決方法:с

<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>

你自己把它們編輯掉了,我的朋友。

您可以在此處找到默認的樣式和模板:

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