<commit_before>﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:gui="clr-namespace:XTreeListView.Gui"
    xmlns:behaviors="clr-namespace:XTreeListView.Behaviors">

    <!-- Including global resources -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/XTreeListView;component/Resources/All.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Template of the item expander toogle button -->
    <ControlTemplate x:Key="ExpandCollapseToggleTemplate" TargetType="ToggleButton">
        <Border Background="Transparent" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
            <Border BorderThickness="1" CornerRadius="1" BorderBrush="#FF7898B5" Width="9" Height="9">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                        <LinearGradientBrush.GradientStops>
                            <GradientStop Color="#FFFFFFFF" Offset="0.2" />
                            <GradientStop Color="#FFC0B7A6" Offset="1" />
                        </LinearGradientBrush.GradientStops>
                    </LinearGradientBrush>
                </Border.Background>
                <Path x:Name="INNER_ExpandPath" Data="M0,2L0,3 2,3 2,5 3,5 3,3 5,3 5,2 3,2 3,0 2,0 2,2z" Fill="#FF000000" Margin="1" />
            </Border>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Data" TargetName="INNER_ExpandPath" Value="M0,2L0,3 5,3 5,2z" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Style of the item expander toogle button -->
    <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Width" Value="14" />
        <Setter Property="Height" Value="14" />
        <Setter Property="Template" Value="{StaticResource ExpandCollapseToggleTemplate}" />
    </Style>

    <!-- Item template used when the ListView does not use GridView -->
    <ControlTemplate x:Key="TreeListViewItemTemplate" TargetType="{x:Type gui:TreeListViewItem}">
        <Grid Margin="1,0,0,0" KeyboardNavigation.DirectionalNavigation="{TemplateBinding KeyboardNavigation.DirectionalNavigation}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border x:Name="INNER_MouseOverBorder" Grid.ColumnSpan="2" Background="Transparent" SnapsToDevicePixels="true" />
            <Border x:Name="INNER_SelectionBorder" Grid.ColumnSpan="2" Background="Transparent" SnapsToDevicePixels="true" />
            <StackPanel x:Name="PART_DecoratorsContainer" Orientation="Horizontal" Height="20" SnapsToDevicePixels="true">
                <ToggleButton x:Name="PART_Expander" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" TabIndex="0" />
                <CheckBox x:Name="PART_CheckBox" VerticalAlignment="Center" TabIndex="1" />
                <Image x:Name="PART_Icon" Width="24" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" />
            </StackPanel>
            <Border Grid.Column="1" Background="Transparent" Padding="2">
                <ContentPresenter x:Name="INNER_ContentPresenter" Focusable="True"
                                  Content="{TemplateBinding Content}" 
                                  ContentTemplate="{TemplateBinding ContentTemplate}" 
                                  ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                  ContentStringFormat="{TemplateBinding ContentStringFormat}" 
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="INNER_SelectionBorder" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="True" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="INNER_SelectionBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
            </MultiTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" TargetName="INNER_MouseOverBorder" Value="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionBrushKey}}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Style of the tree list view item in no column mode -->
    <Style TargetType="{x:Type gui:TreeListViewItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
        <!-- Do not allow arrow navigation when the item has the focus. -->
        <Setter Property="IsTabStop" Value="False" />
        <!-- Do not allow arrow key navigation outside of the item from on of the focused control inside. -->
        <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="None" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Template" Value="{StaticResource TreeListViewItemTemplate}" />
    </Style>

    <!-- Item template used when GridView is put inside the ListView -->
    <ControlTemplate x:Key="MultiColumnTreeListViewItemTemplate" TargetType="{x:Type gui:TreeListViewItem}">
        <Grid Margin="1,0,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border x:Name="INNER_MouseOverBorder" Grid.ColumnSpan="2" Background="Transparent" SnapsToDevicePixels="true" />
            <Border x:Name="INNER_SelectionBorder" Grid.ColumnSpan="2" Background="Transparent" SnapsToDevicePixels="true" />
            <GridViewRowPresenter x:Name="INNER_GridViewRowPresenter" Grid.ColumnSpan="2"
                                  Content="{TemplateBinding Content}" 
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            <StackPanel x:Name="PART_DecoratorsContainer" Orientation="Horizontal" Height="20">
                <ToggleButton x:Name="PART_Expander" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" TabIndex="0" />
                <CheckBox x:Name="PART_CheckBox" VerticalAlignment="Center" TabIndex="1" />
                <Image x:Name="PART_Icon" Width="20" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" />
            </StackPanel>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="True" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="INNER_SelectionBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="INNER_SelectionBorder" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}" />
            </MultiTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" TargetName="INNER_MouseOverBorder" Value="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionBrushKey}}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Style of the tree list view item in multi colums mode -->
    <Style x:Key="{x:Static gui:TreeListViewItem.MultiColumnDefaultStyleKey}"  TargetType="{x:Type gui:TreeListViewItem}" BasedOn="{StaticResource {x:Type gui:TreeListViewItem}}">
        <Setter Property="Template" Value="{StaticResource MultiColumnTreeListViewItemTemplate}" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <!-- Do not allow arrow navigation when the item has the focus. -->
        <Setter Property="IsTabStop" Value="False" />
        <!-- Do not allow arrow key navigation outside of the item from on of the focused control inside. -->
        <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="None" />
    </Style>

    <!-- Template of the tree list view -->
    <ControlTemplate x:Key="TreeListViewTemplate" TargetType="{x:Type gui:TreeListView}">
        <Grid>
            <gui:ExtendedListView x:Name="PART_ListView"
                                  AllowDrop="{TemplateBinding AllowDrop}"
                                  DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                                  ItemTemplate="{TemplateBinding ItemTemplate}"
                                  ItemStringFormat="{TemplateBinding ItemStringFormat}"
                                  ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>

            <!-- This label is used to display a message when the tree is empty. -->
            <Label x:Name="PART_DefaultMessage" IsHitTestVisible="False" Focusable="False" Background="Transparent" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                <TextBlock TextWrapping="Wrap" FontStyle="Italic" Foreground="Gray" Text="{TemplateBinding DefaultMessage}" />
            </Label>
        </Grid>
    </ControlTemplate>
    
    <!-- Style of the tree list view -->
    <Style TargetType="{x:Type gui:TreeListView}">
        <Setter Property="Template" Value="{StaticResource TreeListViewTemplate}" />
        <Setter Property="Focusable" Value="False" />
    </Style>

</ResourceDictionary>
<commit_msg>[FCT] Improving the way the icon is displayed.<commit_after>﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:gui="clr-namespace:XTreeListView.Gui"
    xmlns:behaviors="clr-namespace:XTreeListView.Behaviors">

    <!-- Including global resources -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/XTreeListView;component/Resources/All.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Template of the item expander toogle button -->
    <ControlTemplate x:Key="ExpandCollapseToggleTemplate" TargetType="ToggleButton">
        <Border Background="Transparent" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
            <Border BorderThickness="1" CornerRadius="1" BorderBrush="#FF7898B5" Width="9" Height="9">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                        <LinearGradientBrush.GradientStops>
                            <GradientStop Color="#FFFFFFFF" Offset="0.2" />
                            <GradientStop Color="#FFC0B7A6" Offset="1" />
                        </LinearGradientBrush.GradientStops>
                    </LinearGradientBrush>
                </Border.Background>
                <Path x:Name="INNER_ExpandPath" Data="M0,2L0,3 2,3 2,5 3,5 3,3 5,3 5,2 3,2 3,0 2,0 2,2z" Fill="#FF000000" Margin="1" />
            </Border>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Data" TargetName="INNER_ExpandPath" Value="M0,2L0,3 5,3 5,2z" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Style of the item expander toogle button -->
    <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Width" Value="14" />
        <Setter Property="Height" Value="14" />
        <Setter Property="Template" Value="{StaticResource ExpandCollapseToggleTemplate}" />
    </Style>

    <!-- Item template used when the ListView does not use GridView -->
    <ControlTemplate x:Key="TreeListViewItemTemplate" TargetType="{x:Type gui:TreeListViewItem}">
        <Grid Margin="1,0,0,0" KeyboardNavigation.DirectionalNavigation="{TemplateBinding KeyboardNavigation.DirectionalNavigation}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border x:Name="INNER_MouseOverBorder" Grid.ColumnSpan="2" Background="Transparent" SnapsToDevicePixels="true" />
            <Border x:Name="INNER_SelectionBorder" Grid.ColumnSpan="2" Background="Transparent" SnapsToDevicePixels="true" />
            <StackPanel x:Name="PART_DecoratorsContainer" Orientation="Horizontal" Height="20" SnapsToDevicePixels="true">
                <ToggleButton x:Name="PART_Expander" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" TabIndex="0" />
                <CheckBox x:Name="PART_CheckBox" VerticalAlignment="Center" TabIndex="1" />
                <Image x:Name="PART_Icon" Width="24" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor" />
            </StackPanel>
            <Border Grid.Column="1" Background="Transparent" Padding="2">
                <ContentPresenter x:Name="INNER_ContentPresenter" Focusable="True"
                                  Content="{TemplateBinding Content}" 
                                  ContentTemplate="{TemplateBinding ContentTemplate}" 
                                  ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                  ContentStringFormat="{TemplateBinding ContentStringFormat}" 
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="INNER_SelectionBorder" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="True" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="INNER_SelectionBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
            </MultiTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" TargetName="INNER_MouseOverBorder" Value="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionBrushKey}}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Style of the tree list view item in no column mode -->
    <Style TargetType="{x:Type gui:TreeListViewItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
        <!-- Do not allow arrow navigation when the item has the focus. -->
        <Setter Property="IsTabStop" Value="False" />
        <!-- Do not allow arrow key navigation outside of the item from on of the focused control inside. -->
        <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="None" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Template" Value="{StaticResource TreeListViewItemTemplate}" />
    </Style>

    <!-- Item template used when GridView is put inside the ListView -->
    <ControlTemplate x:Key="MultiColumnTreeListViewItemTemplate" TargetType="{x:Type gui:TreeListViewItem}">
        <Grid Margin="1,0,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border x:Name="INNER_MouseOverBorder" Grid.ColumnSpan="2" Background="Transparent" SnapsToDevicePixels="true" />
            <Border x:Name="INNER_SelectionBorder" Grid.ColumnSpan="2" Background="Transparent" SnapsToDevicePixels="true" />
            <GridViewRowPresenter x:Name="INNER_GridViewRowPresenter" Grid.ColumnSpan="2"
                                  Content="{TemplateBinding Content}" 
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            <StackPanel x:Name="PART_DecoratorsContainer" Orientation="Horizontal" Height="20">
                <ToggleButton x:Name="PART_Expander" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" TabIndex="0" />
                <CheckBox x:Name="PART_CheckBox" VerticalAlignment="Center" TabIndex="1" />
                <Image x:Name="PART_Icon" Width="20" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor" />
            </StackPanel>
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="True" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="INNER_SelectionBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                    <Condition Property="IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="INNER_SelectionBorder" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}" />
            </MultiTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" TargetName="INNER_MouseOverBorder" Value="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionBrushKey}}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Style of the tree list view item in multi colums mode -->
    <Style x:Key="{x:Static gui:TreeListViewItem.MultiColumnDefaultStyleKey}"  TargetType="{x:Type gui:TreeListViewItem}" BasedOn="{StaticResource {x:Type gui:TreeListViewItem}}">
        <Setter Property="Template" Value="{StaticResource MultiColumnTreeListViewItemTemplate}" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <!-- Do not allow arrow navigation when the item has the focus. -->
        <Setter Property="IsTabStop" Value="False" />
        <!-- Do not allow arrow key navigation outside of the item from on of the focused control inside. -->
        <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="None" />
    </Style>

    <!-- Template of the tree list view -->
    <ControlTemplate x:Key="TreeListViewTemplate" TargetType="{x:Type gui:TreeListView}">
        <Grid>
            <gui:ExtendedListView x:Name="PART_ListView"
                                  AllowDrop="{TemplateBinding AllowDrop}"
                                  DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                                  ItemTemplate="{TemplateBinding ItemTemplate}"
                                  ItemStringFormat="{TemplateBinding ItemStringFormat}"
                                  ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>

            <!-- This label is used to display a message when the tree is empty. -->
            <Label x:Name="PART_DefaultMessage" IsHitTestVisible="False" Focusable="False" Background="Transparent" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                <TextBlock TextWrapping="Wrap" FontStyle="Italic" Foreground="Gray" Text="{TemplateBinding DefaultMessage}" />
            </Label>
        </Grid>
    </ControlTemplate>
    
    <!-- Style of the tree list view -->
    <Style TargetType="{x:Type gui:TreeListView}">
        <Setter Property="Template" Value="{StaticResource TreeListViewTemplate}" />
        <Setter Property="Focusable" Value="False" />
    </Style>

</ResourceDictionary>

{'fraction_non_alphanumeric': 0.1167861536503627, 'fraction_numerical': 0.00856912569465066, 'mean_word_length': 2.8127122755943716, 'pattern_counts': {'":': 0, '<': 293, '<?xml version=': 0, '>': 293, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3201568', 'n_tokens_mistral': 6146, 'n_tokens_neox': 5594, 'n_words': 1111}