<commit_before>﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Converters="clr-namespace:MahApps.Metro.Converters">

    <Converters:ToUpperConverter x:Key="ToUpperConverter" />

    <Style x:Key="ListViewScrollViewerStyle"
           TargetType="{x:Type ScrollViewer}"
           BasedOn="{StaticResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
        <Setter Property="VerticalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="HorizontalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="OverridesDefaultStyle"
                Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <ScrollContentPresenter Grid.Column="0"
                                                Margin="{TemplateBinding Padding}"
                                                Content="{TemplateBinding Content}"
                                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                                CanContentScroll="{TemplateBinding CanContentScroll}" />

                        <ScrollBar Name="PART_VerticalScrollBar"
                                   AutomationProperties.AutomationId="VerticalScrollBar"
                                   Cursor="Arrow"
                                   Grid.Row="0"
                                   Grid.Column="1"
                                   HorizontalAlignment="Center"
                                   Value="{TemplateBinding VerticalOffset}"
                                   Maximum="{TemplateBinding ScrollableHeight}"
                                   ViewportSize="{TemplateBinding ViewportHeight}"
                                   Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" />

                        <ScrollBar Name="PART_HorizontalScrollBar"
                                   AutomationProperties.AutomationId="HorizontalScrollBar"
                                   Cursor="Arrow"
                                   Orientation="Horizontal"
                                   Grid.Row="1"
                                   Grid.Column="0"
                                   Value="{TemplateBinding HorizontalOffset}"
                                   Maximum="{TemplateBinding ScrollableWidth}"
                                   ViewportSize="{TemplateBinding ViewportWidth}"
                                   Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    Do not set CanContentScroll=True below. This breaks the scrolling for groups with more items that will fit on screen. 
    It also (setting true) has the ugly side effect of scrolling the entire group and not the items. The downside is we lose 
    virtualisation http://serialseb.blogspot.com/2007/09/wpf-tips-7-smooth-scrolling.html 
    -->
    <Style x:Key="MetroListView"
           TargetType="{x:Type ListView}">
        <Setter Property="BorderBrush"
                Value="{DynamicResource BlackBrush}" />
        <Setter Property="Background"
                Value="{DynamicResource WhiteBrush}" />
        <Setter Property="BorderThickness"
                Value="0 1 0 0" />
        <Setter Property="ScrollViewer.CanContentScroll"
                Value="False" />
        <Setter Property="AlternationCount"
                Value="2" />

        <!-- Things taken from the original template. -->
        <Setter Property="SnapsToDevicePixels"
                Value="true" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListView">
                    <Border x:Name="Border"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ScrollViewer Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
                        <!--<ScrollViewer Style="{StaticResource ListViewScrollViewerStyle}">-->
                            <ItemsPresenter />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping"
                                 Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll"
                                    Value="false" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Border"
                                    Property="BorderBrush"
                                    Value="{DynamicResource GrayBrush9}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value><commit_msg>better MetroGridViewScrollViewerStyle<commit_after>﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Converters="clr-namespace:MahApps.Metro.Converters">

    <Converters:ToUpperConverter x:Key="ToUpperConverter" />

    <Style x:Key="MetroGridViewScrollViewerStyle"
           TargetType="{x:Type ScrollViewer}"
           BasedOn="{StaticResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
        <Setter Property="Focusable"
                Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid Background="{TemplateBinding Background}"
                          SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <DockPanel Margin="{TemplateBinding Padding}">
                            <ScrollViewer DockPanel.Dock="Top"
                                          Focusable="false"
                                          HorizontalScrollBarVisibility="Hidden"
                                          VerticalScrollBarVisibility="Hidden">
                                <GridViewHeaderRowPresenter AllowsColumnReorder="{Binding TemplatedParent.View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderContainerStyle="{Binding TemplatedParent.View.ColumnHeaderContainerStyle, RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderToolTip="{Binding TemplatedParent.View.ColumnHeaderToolTip, RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderStringFormat="{Binding TemplatedParent.View.ColumnHeaderStringFormat, RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderContextMenu="{Binding TemplatedParent.View.ColumnHeaderContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderTemplate="{Binding TemplatedParent.View.ColumnHeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}"
                                                            Columns="{Binding TemplatedParent.View.Columns, RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderTemplateSelector="{Binding TemplatedParent.View.ColumnHeaderTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}"
                                                            Margin="2,0,2,0"
                                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </ScrollViewer>
                            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
                                                    CanContentScroll="{TemplateBinding CanContentScroll}"
                                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                                    Content="{TemplateBinding Content}"
                                                    KeyboardNavigation.DirectionalNavigation="Local"
                                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </DockPanel>
                        <ScrollBar x:Name="PART_HorizontalScrollBar"
                                   Cursor="Arrow"
                                   Maximum="{TemplateBinding ScrollableWidth}"
                                   Minimum="0.0"
                                   Orientation="Horizontal"
                                   Grid.Row="1"
                                   Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                   Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                                   ViewportSize="{TemplateBinding ViewportWidth}" />
                        <ScrollBar x:Name="PART_VerticalScrollBar"
                                   Cursor="Arrow"
                                   Grid.Column="1"
                                   Maximum="{TemplateBinding ScrollableHeight}"
                                   Minimum="0.0"
                                   Orientation="Vertical"
                                   Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                   Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                                   ViewportSize="{TemplateBinding ViewportHeight}" />
                        <!-- this is from original style, but we don't want it!!!
                        <DockPanel Background="{Binding Background, ElementName=PART_VerticalScrollBar}"
                                   Grid.Column="1"
                                   LastChildFill="false"
                                   Grid.Row="1">
                            <Rectangle DockPanel.Dock="Left"
                                       Fill="White"
                                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                       Width="1" />
                            <Rectangle DockPanel.Dock="Top"
                                       Fill="White"
                                       Height="1"
                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" />
                        </DockPanel>
                        -->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    Do not set CanContentScroll=True below. This breaks the scrolling for groups with more items that will fit on screen. 
    It also (setting true) has the ugly side effect of scrolling the entire group and not the items. The downside is we lose 
    virtualisation http://serialseb.blogspot.com/2007/09/wpf-tips-7-smooth-scrolling.html 
    -->
    <Style x:Key="MetroListView"
           TargetType="{x:Type ListView}">
        <Setter Property="BorderBrush"
                Value="{DynamicResource BlackBrush}" />
        <Setter Property="Background"
                Value="{DynamicResource WhiteBrush}" />
        <Setter Property="BorderThickness"
                Value="0 1 0 0" />
        <Setter Property="ScrollViewer.CanContentScroll"
                Value="False" />
        <Setter Property="AlternationCount"
                Value="2" />

        <!-- Things taken from the original template. -->
        <Setter Property="SnapsToDevicePixels"
                Value="true" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListView">
                    <Border x:Name="Border"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="true">
                        <ScrollViewer Padding="{TemplateBinding Padding}"
                                      Style="{DynamicResource MetroGridViewScrollViewerStyle}">
                            <ItemsPresenter />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping"
                                 Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll"
                                    Value="false" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Border"
                                    Property="BorderBrush"
                                    Value="{DynamicResource GrayBrush9}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
{'fraction_non_alphanumeric': 0.08353824252620681, 'fraction_numerical': 0.003947198136404814, 'mean_word_length': 1.2950697950697951, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 127, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 96, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5439995', 'n_tokens_mistral': 3301, 'n_tokens_neox': 2897, 'n_words': 511}