<UserControl
    x:Class="XamlCruncher.SettingsDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:XamlCruncher"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    
    <UserControl.Resources>
        <Style x:Key="DialogCaptionTextStyle"
               TargetType="TextBlock"
               BasedOn="{StaticResource CaptionTextStyle}">
            <Setter Property="FontSize" Value="14.67" />
            <Setter Property="FontWeight" Value="SemiLight" />
            <Setter Property="Margin" Value="7 0 0 0" />
        </Style>
    </UserControl.Resources>
    
    <Border Background="{StaticResource ApplicationPageBackgroundThemeBrush}"
            BorderBrush="{StaticResource ApplicationForegroundThemeBrush}"
            BorderThickness="1">
        <StackPanel Margin="24">
            <TextBlock Text="Ustawienia XamlCruncher"
                       Style="{StaticResource SubheaderTextStyle}"
                       Margin="0 0 0 12" />

            <!-- Auto parsing -->
            <ToggleSwitch Header="Automatyczne parsowanie"
                          IsOn="{Binding AutoParsing, Mode=TwoWay}" />

            <!-- Orientation -->
            <TextBlock Text="Orientacja"
                       Style="{StaticResource DialogCaptionTextStyle}" />
            
            <Grid Name="orientationRadioButtonGrid"
                  Margin="7 0 0 0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                
                <Grid.Resources>
                    <Style TargetType="Border">
                        <Setter Property="BorderBrush" 
                                Value="{StaticResource ApplicationForegroundThemeBrush}" />
                        <Setter Property="BorderThickness" Value="1" />
                        <Setter Property="Padding" Value="3" />
                    </Style>
                    
                    <Style TargetType="TextBlock">
                        <Setter Property="TextAlignment" Value="Center" />
                    </Style>

                    <Style TargetType="local:EditOrientationRadioButton">
                        <Setter Property="Margin" Value="0 6 12 6" />
                    </Style>
                </Grid.Resources>
                
                <local:EditOrientationRadioButton Grid.Row="0" Grid.Column="0"
                                                  EditOrientationTag="Left"
                             Checked="OnOrientationRadioButtonChecked">
                    <StackPanel Orientation="Horizontal">
                        <Border>
                            <TextBlock Text="edycja" />
                        </Border>
                        <Border>
                            <TextBlock Text="pokaz" />
                        </Border>
                    </StackPanel>
                </local:EditOrientationRadioButton>

                <local:EditOrientationRadioButton Grid.Row="0" Grid.Column="1"
                                                  EditOrientationTag="Bottom"
                             Checked="OnOrientationRadioButtonChecked">
                    <StackPanel>
                        <Border>
                            <TextBlock Text="pokaz" />
                        </Border>
                        <Border>
                            <TextBlock Text="edycja" />
                        </Border>
                    </StackPanel>
                </local:EditOrientationRadioButton>

                <local:EditOrientationRadioButton Grid.Row="1" Grid.Column="0"
                                                  EditOrientationTag="Top"
                             Checked="OnOrientationRadioButtonChecked">
                    <StackPanel>
                        <Border>
                            <TextBlock Text="edycja" />
                        </Border>
                        <Border>
                            <TextBlock Text="pokaz" />
                        </Border>
                    </StackPanel>
                </local:EditOrientationRadioButton>

                <local:EditOrientationRadioButton Grid.Row="1" Grid.Column="1"
                                                  EditOrientationTag="Right"
                             Checked="OnOrientationRadioButtonChecked">
                    <StackPanel Orientation="Horizontal">
                        <Border>
                            <TextBlock Text="pokaz" />
                        </Border>
                        <Border>
                            <TextBlock Text="edycja" />
                        </Border>
                    </StackPanel>
                </local:EditOrientationRadioButton>
            </Grid>
            
            <!-- Ruler -->
            <ToggleSwitch Header="Linijka"
                          OnContent="Pokaż"
                          OffContent="Ukryj"
                          IsOn="{Binding ShowRuler, Mode=TwoWay}" />

            <!-- Grid lines --> 
            <ToggleSwitch Header="Linie siatki"
                          OnContent="Pokaż"
                          OffContent="Ukryj"
                          IsOn="{Binding ShowGridLines, Mode=TwoWay}" />
            
            <!-- Font size -->
            <TextBlock Text="Rozmiar czcionki"
                       Style="{StaticResource DialogCaptionTextStyle}" />
            
            <Slider Value="{Binding FontSize, Mode=TwoWay}"
                    Minimum="10"
                    Maximum="48"
                    Margin="7 0 0 0" />

            <!-- Tab spaces -->
            <TextBlock Text="Spacje tabulacji"
                       Style="{StaticResource DialogCaptionTextStyle}" />

            <Slider Value="{Binding TabSpaces, Mode=TwoWay}"
                    Minimum="1"
                    Maximum="12"
                    Margin="7 0 0 0" />
        </StackPanel>
    </Border>
</UserControl>
