<Application
        x:Class="Elwig.App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ctrl="clr-namespace:Elwig.Controls"
        Exit="Application_Exit">
    <Application.Resources>
        <ctrl:BoolToStringConverter x:Key="BoolToStarConverter" FalseValue="" TrueValue="*"/>
        <ctrl:WidthToMarginConverter x:Key="WidthToMarginConverter"/>

        <DataTemplate x:Key="PostalDestTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Dest}"/>
                <TextBlock Text="{Binding Ort.Name, StringFormat='{} ({0})'}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="KgNrTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}"/>
                <TextBlock Text="{Binding KgNr, StringFormat='{} ({0:00000})'}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="MemberAdminNameTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding MgNr}" MinWidth="48" Margin="0,0,10,0" TextAlignment="Right"/>
                <TextBlock Text="{Binding AdministrativeName1}" MinWidth="100" Margin="0,0,5,0"/>
                <TextBlock Text="{Binding AdministrativeName2}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="WineVarietyTemplateCollapsed">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" Foreground="{Binding Color}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="WineVarietyTemplateExpanded">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding SortIdFormat}" Foreground="{Binding Color}" MinWidth="36" Margin="0,0,10,0"/>
                <TextBlock Text="{Binding Name}" Foreground="{Binding Color}"/>
                <TextBlock Text="{Binding CommentFormat}" FontSize="10" VerticalAlignment="Bottom" Margin="0,0,0,2"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="AreaCommitmentTypeTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding WineVar.Name}" Foreground="{Binding WineVar.Color}"/>
                <TextBlock Text="{Binding WineAttr.Name}" Margin="5,0,0,0"/>
                <TextBlock Text="{Binding Discriminator}" Margin="5,0,0,0"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="ModifierTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" MinWidth="250" Margin="0,0,10,0"/>
                <TextBlock Text="{Binding ValueStr}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="PublicModifierTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" MinWidth="250" Margin="0,0,10,0"/>
                <TextBlock Text="{Binding PublicValueStr}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="WineAttributeTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" MinWidth="150" Margin="0,0,10,0"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="WineQualityLevelTemplateCollapsed">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="WineQualityLevelTemplateExpanded">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding IsPredicate, Converter={StaticResource BoolToStarConverter}}" MinWidth="6"/>
                <TextBlock Text="{Binding Name}" MinWidth="100" Margin="0,0,10,0"/>
                <TextBlock Text="{Binding MinKmwStr}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="WineOriginTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding HkIdLevel}" MinWidth="70" Margin="0,0,10,0"/>
                <TextBlock Text="{Binding Name}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="WineOriginTemplateCollapsed">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="WineOriginTemplateExpanded">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding HkIdLevel}" MinWidth="70" Margin="0,0,10,0"/>
                <TextBlock Text="{Binding Name}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="GemTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}"/>
                <TextBlock Text="{Binding Gkz, StringFormat='{} ({0:00000})'}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="WbKgTemplate">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <TextBlock Width="250">
                    <TextBlock Text="{Binding Name}"/>
                    <TextBlock Text="{Binding KgNr, StringFormat='{}({0:00000})'}"/>
                </TextBlock>
                <TextBlock Text="{Binding Gem.WbGem.Origin.Name}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="WbKgGlTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Width="220">
                    <TextBlock Text="{Binding Name}"/>
                    <TextBlock Text="{Binding KgNr, StringFormat='{}({0:00000})'}"/>
                </TextBlock>
                <TextBlock Text="{Binding WbKg.Gl.Name}"/>
            </StackPanel>
        </DataTemplate>
    </Application.Resources>
</Application>
