<commit_before>﻿<UserControl x:Class="tomenglertde.ResXManager.View.Visuals.LanguageConfigurationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"
             xmlns:model="urn:ResXManager.Model"
             xmlns:converters="clr-namespace:tomenglertde.ResXManager.View.Converters"
             xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib"
             xmlns:properties="clr-namespace:tomenglertde.ResXManager.View.Properties"
             xmlns:visuals="clr-namespace:tomenglertde.ResXManager.View.Visuals"
             xmlns:styles="urn:TomsToolbox.Wpf.Styles"
             d:DataContext="{d:DesignInstance visuals:LanguageConfigurationViewModel}">
  <UserControl.Resources>

    <ControlTemplate x:Key="LanguageControlTemplate">
      <StackPanel Orientation="Horizontal" Margin="0,2" d:DataContext="{d:DesignInstance globalization:CultureInfo}">
        <Decorator Width="2" />
        <Image Width="16" Height="16" Source="{Binding Converter={x:Static converters:CultureToImageSourceConverter.Default}}" />
        <Decorator Width="5" />
        <TextBlock Text="{Binding Name}" FontWeight="Bold" />
        <Decorator Width="5" />
        <TextBlock Text="{Binding DisplayName}" />
        <Decorator Width="10" />
      </StackPanel>
    </ControlTemplate>

    <DataTemplate x:Key="LanguageDataTemplate" DataType="{x:Type globalization:CultureInfo}">
      <Control Template="{StaticResource LanguageControlTemplate}" MouseDoubleClick="Language_MouseDoubleClick" />
    </DataTemplate>

    <DataTemplate x:Key="LanguageGroupHeaderDataTemplate" DataType="{x:Type CollectionViewGroup}">
      <Border Margin="0,5,0,0" Background="{DynamicResource {x:Static styles:ResourceKeys.BorderBrush}}">
        <Control Template="{StaticResource LanguageControlTemplate}" DataContext="{Binding Name}" Focusable="False" />
      </Border>
    </DataTemplate>

    <CollectionViewSource x:Key="CollectionViewSource" Source="{x:Static model:ResourceManager.SpecificCultures}">
      <CollectionViewSource.GroupDescriptions>
        <visuals:CultureInfoGroupDescription />
      </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>

  </UserControl.Resources>
  <DockPanel>
    <TextBlock DockPanel.Dock="Top" TextWrapping="Wrap" Margin="5" Foreground="Gray"
               Text="{x:Static properties:Resources.LanguageConfiguration_Description}" />
    <ListBox x:Name="ListBox" Style="{DynamicResource {x:Static styles:ResourceKeys.ListBoxStyle}}"
             ItemsSource="{Binding Source={StaticResource CollectionViewSource}}"
             ItemTemplate="{StaticResource LanguageDataTemplate}"
             ScrollViewer.VerticalScrollBarVisibility="Disabled"
             BorderThickness="0,1,0,0">
      <ListBox.GroupStyle>
        <GroupStyle HeaderTemplate="{StaticResource LanguageGroupHeaderDataTemplate}">
          <GroupStyle.Panel>
            <ItemsPanelTemplate>
              <WrapPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
          </GroupStyle.Panel>
        </GroupStyle>
      </ListBox.GroupStyle>
    </ListBox>
  </DockPanel>
</UserControl><commit_msg>Fix  #46: Make languages scroll vertically if panel size exceeds container size<commit_after>﻿<UserControl x:Class="tomenglertde.ResXManager.View.Visuals.LanguageConfigurationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"
             xmlns:model="urn:ResXManager.Model"
             xmlns:converters="clr-namespace:tomenglertde.ResXManager.View.Converters"
             xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib"
             xmlns:properties="clr-namespace:tomenglertde.ResXManager.View.Properties"
             xmlns:visuals="clr-namespace:tomenglertde.ResXManager.View.Visuals"
             xmlns:styles="urn:TomsToolbox.Wpf.Styles"
             d:DataContext="{d:DesignInstance visuals:LanguageConfigurationViewModel}">
  <UserControl.Resources>

    <ControlTemplate x:Key="LanguageControlTemplate">
      <StackPanel Orientation="Horizontal" Margin="0,2" d:DataContext="{d:DesignInstance globalization:CultureInfo}">
        <Decorator Width="2" />
        <Image Width="16" Height="16" Source="{Binding Converter={x:Static converters:CultureToImageSourceConverter.Default}}" />
        <Decorator Width="5" />
        <TextBlock Text="{Binding Name}" FontWeight="Bold" />
        <Decorator Width="5" />
        <TextBlock Text="{Binding DisplayName}" />
        <Decorator Width="10" />
      </StackPanel>
    </ControlTemplate>

    <DataTemplate x:Key="LanguageDataTemplate" DataType="{x:Type globalization:CultureInfo}">
      <Control Template="{StaticResource LanguageControlTemplate}" MouseDoubleClick="Language_MouseDoubleClick" />
    </DataTemplate>

    <DataTemplate x:Key="LanguageGroupHeaderDataTemplate" DataType="{x:Type CollectionViewGroup}">
      <Border Margin="0,5,0,0" Background="{DynamicResource {x:Static styles:ResourceKeys.BorderBrush}}">
        <Control Template="{StaticResource LanguageControlTemplate}" DataContext="{Binding Name}" Focusable="False" />
      </Border>
    </DataTemplate>

    <CollectionViewSource x:Key="CollectionViewSource" Source="{x:Static model:ResourceManager.SpecificCultures}">
      <CollectionViewSource.GroupDescriptions>
        <visuals:CultureInfoGroupDescription />
      </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>

  </UserControl.Resources>
  <DockPanel>
    <TextBlock DockPanel.Dock="Top" TextWrapping="Wrap" Margin="5" Foreground="Gray"
               Text="{x:Static properties:Resources.LanguageConfiguration_Description}" />
    <Grid>
      <Decorator VerticalAlignment="Stretch" Margin="22" x:Name="ContainerSizeTemplate" />
      <ListBox x:Name="ListBox" Style="{DynamicResource {x:Static styles:ResourceKeys.ListBoxStyle}}"
               ItemsSource="{Binding Source={StaticResource CollectionViewSource}}"
               ItemTemplate="{StaticResource LanguageDataTemplate}"
               ScrollViewer.VerticalScrollBarVisibility="Disabled"
               BorderThickness="0,1,0,0">
        <ListBox.GroupStyle>
          <GroupStyle HeaderTemplate="{StaticResource LanguageGroupHeaderDataTemplate}">
            <GroupStyle.ContainerStyle>
              <Style TargetType="GroupItem">
                <Setter Property="Template">
                  <Setter.Value>
                    <ControlTemplate TargetType="{x:Type GroupItem}">
                      <StackPanel>
                        <ContentPresenter x:Name="PART_Header" />
                        <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto" MaxHeight="{Binding ActualHeight, ElementName=ContainerSizeTemplate}">
                          <ItemsPresenter x:Name="ItemsPresenter" Margin="5,0,0,0" />
                        </ScrollViewer>
                      </StackPanel>
                    </ControlTemplate>
                  </Setter.Value>
                </Setter>
              </Style>
            </GroupStyle.ContainerStyle>
            <GroupStyle.Panel>
              <ItemsPanelTemplate>
                <WrapPanel Orientation="Vertical" />
              </ItemsPanelTemplate>
            </GroupStyle.Panel>
          </GroupStyle>
        </ListBox.GroupStyle>
      </ListBox>
    </Grid>
  </DockPanel>
</UserControl>
{'fraction_non_alphanumeric': 0.1253145445395068, 'fraction_numerical': 0.011575239053850024, 'mean_word_length': 3.5139125496876775, 'pattern_counts': {'":': 0, '<': 106, '<?xml version=': 0, '>': 106, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 22}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5523130', 'n_tokens_mistral': 2278, 'n_tokens_neox': 2123, 'n_words': 280}