How to remove ListView GroupStyle Header separator string?

In ListViews on the universal Windows platform, under the group heading there is an ugly separator line when you use ListView grouping. Even Microsoft itself deleted this line in its applications. I do not use Semantic Zoom, I just want to delete this line. In Live Visual Tree, you can see that it is a rectangle in the GridViewHeaderItem. I read that you can set its height to 0. How can I do this?

Here is the code that sets the text of the title element:

<ListView.GroupStyle>
  <GroupStyle HidesIfEmpty="True" >
     <GroupStyle.HeaderTemplate>
        <DataTemplate>
                  <TextBlock Text="{Binding Name}"/>
        </DataTemplate>
     </GroupStyle.HeaderTemplate>
   </GroupStyle>
</ListView.GroupStyle>
+4
source share
1 answer

You can find all default styles in generic.xaml in

C:\Program Files (x86)\Windows \10\DesignTime\CommonConfiguration\\\10.0.10240.0\Generic

, ListViewHeaderItem:

<!-- Default style for Windows.UI.Xaml.Controls.ListViewHeaderItem -->
<Style TargetType="ListViewHeaderItem">
    <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
    <Setter Property="FontSize" Value="{ThemeResource ListViewHeaderItemThemeFontSize}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Margin" Value="0,0,0,4"/>
    <Setter Property="Padding" Value="12,8,12,0"/>
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="VerticalContentAlignment" Value="Top" />
    <Setter Property="MinHeight" Value="{ThemeResource ListViewHeaderItemMinHeight}"/>
    <Setter Property="UseSystemFocusVisuals" Value="True" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ListViewHeaderItem">
                <StackPanel Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                    <ContentPresenter x:Name="ContentPresenter"
                                      Margin="{TemplateBinding Padding}"
                                      Content="{TemplateBinding Content}"
                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                      ContentTransitions="{TemplateBinding ContentTransitions}"
                                      HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    <Rectangle Stroke="{ThemeResource SystemControlForegroundBaseLowBrush}"
                               StrokeThickness="0.5"
                               Height="1"
                               VerticalAlignment="Bottom"
                               HorizontalAlignment="Stretch"
                               Margin="12,8,12,0"/>
                </StackPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

ResourceDictionary Rectangle ( ContentPresenter ).

<Rectangle Stroke="{ThemeResource SystemControlForegroundBaseLowBrush}"
           StrokeThickness="0.5"
           Height="1"
           VerticalAlignment="Bottom"
           HorizontalAlignment="Stretch"
           Margin="12,8,12,0"/>
+17

Source: https://habr.com/ru/post/1615583/