<Window x:Class="Dependencies.UserSettings"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Dependencies"
        xmlns:properties="clr-namespace:Dependencies.Properties"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        mc:Ignorable="d"
        Title="UserSettings"
        Height="400" Width="700"
        WindowStartupLocation="CenterOwner">
    <Window.Resources>
        <local:TreeBuildingBehaviour x:Key="TreeBuildingBehaviourConverter"/>
        <local:BinaryCacheOption x:Key="BinaryCacheOptionConverter"/>
    </Window.Resources>
    <Grid Margin="10 20 20 20" >

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Label Margin="5" 
               Grid.Row="0"
               Grid.Column="0"
               Content="Use BinaryCache:" 
               HorizontalAlignment="Left" 
               VerticalAlignment="Center" />

        <ComboBox x:Name="BinaryCacheCombo"
                  Margin="5"
                  Grid.Row="0"
                  Grid.Column="1" 
                  SelectedItem="{Binding Source={x:Static properties:Settings.Default}, Path=BinaryCacheOptionValue, Mode=OneWay, Converter={StaticResource BinaryCacheOptionConverter}}"
                  />

        <!-- Previewer Path selection -->
        <Label Content="Peviewer path:"
               Margin="5"
               Grid.Column="0"
               Grid.Row="1"
               HorizontalAlignment="Left" 
               VerticalAlignment="Center" />

        <Grid Margin="5" Grid.Row="1" Grid.Column="1">

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBox Grid.Column="0"
                     Text="{Binding Source={x:Static properties:Settings.Default}, Path=PeViewerPath, Mode=OneWay}"
                     TextWrapping="Wrap" 
                     VerticalContentAlignment="Center" />

            <Button Margin="2 0 0 0"
                    Grid.Column="1"
                    Width="30"
                    Content="..."
                    Click="OnPeviewerPathSettingChange" />
        </Grid>

        
        <!-- Tree build behaviour selection -->
        <Label Margin="5" 
               Grid.Row="2"
               Grid.Column="0"
               Content="Tree build behaviour:" 
               HorizontalAlignment="Left" 
               VerticalAlignment="Center" />

        <ComboBox x:Name="TreeBuildCombo"
                  Margin="5"
                  Grid.Row="2"
                  Grid.Column="1" 
                  SelectedItem="{Binding Source={x:Static properties:Settings.Default}, Path=TreeBuildBehaviour, Mode=OneWay, Converter={StaticResource TreeBuildingBehaviourConverter}}"
                  />

        <!-- Tree depth -->
        <Label Margin="5" 
               Grid.Row="3"
               Grid.Column="0"
               Content="Tree depth:" 
               HorizontalAlignment="Left" 
               VerticalAlignment="Center" />

        <TextBox  Name="TreeDepthValue"
                  PreviewTextInput="NumericOnly"
                  Grid.Row="3"
                  Grid.Column="1" 
                  Margin="5"
                  Text="{Binding Source={x:Static properties:Settings.Default}, Path=TreeDepth, Mode=OneWay}"
                  TextWrapping="Wrap" 
                  VerticalContentAlignment="Center" />


        <!-- Font family selection -->
        <Label Margin="5"
               Grid.Row="4"
               Grid.Column="0"
               Content="Font family:" 
               HorizontalAlignment="Left" 
               VerticalAlignment="Top" />

        <ListBox Name="FontFamilyList"
                 Margin="5"
                 Grid.Row="4"
                 Grid.Column="1" />
        
        
        <!-- Buttons -->
        <StackPanel Grid.Row="5" Grid.Column="1" 
                    Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Cancel" 
                    Height="20"
                    Width="60"
                    Margin="2"
                    Padding="2"
                    Click="OnCancel" />

            <Button Content="OK" 
                    Height="20"
                    Width="60"
                    Margin="2"
                    Padding="2"
                    Click="OnValidate" />
        </StackPanel>

    </Grid>
</Window>
