<UserControl x:Class="JuliusSweetland.OptiKey.UI.Views.Management.WordsView"
             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"
             xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </UserControl.Resources>
    
    <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
        
            <GroupBox Grid.Row="0" Header="Language">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" SharedSizeGroup="LabelColumn" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
            
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Language:" 
                               VerticalAlignment="Center" Margin="5" />
                    <ComboBox Grid.Row="0" Grid.Column="1" 
                              ItemsSource="{Binding Languages}"
                              DisplayMemberPath="Key"
                              SelectedValuePath="Value"
                              SelectedValue="{Binding Language, Mode=TwoWay}" />
                </Grid>
            </GroupBox>
        
            <GroupBox Grid.Row="1" Header="Automatic sentence adjustments">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" SharedSizeGroup="LabelColumn" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
            
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Auto space between words:" 
                               VerticalAlignment="Center" Margin="5" />
                    <CheckBox Grid.Row="0" Grid.Column="1" 
                              VerticalAlignment="Center"
                              IsChecked="{Binding AutoAddSpace, Mode=TwoWay}" />
            
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Auto capitalise words:" 
                               VerticalAlignment="Center" Margin="5" />
                    <CheckBox Grid.Row="1" Grid.Column="1" 
                              VerticalAlignment="Center"
                              IsChecked="{Binding AutoCapitalise, Mode=TwoWay}" />

                    <TextBlock Grid.Row="2" Grid.Column="0" Text="...but intelligently suppress auto-caps where it is probably unhelpful:" 
                               VerticalAlignment="Center" Margin="5">
                        <TextBlock.Style>
                            <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
                                <Setter Property="Visibility" Value="Visible" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding AutoCapitalise}" Value="False">
                                        <Setter Property="Visibility" Value="Collapsed" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBlock.Style>
                    </TextBlock>
                    <CheckBox Grid.Row="2" Grid.Column="1" 
                              VerticalAlignment="Center"
                              IsChecked="{Binding SuppressAutoCapitaliseIntelligently, Mode=TwoWay}">
                        <CheckBox.Style>
                            <Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
                                <Setter Property="Visibility" Value="Visible" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding AutoCapitalise}" Value="False">
                                        <Setter Property="Visibility" Value="Collapsed" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </CheckBox.Style>    
                    </CheckBox>
                    
                    <TextBlock Grid.Row="3" Grid.Column="0" Text="Auto complete words:" 
                               VerticalAlignment="Center" Margin="5" />
                    <CheckBox Grid.Row="3" Grid.Column="1" 
                              VerticalAlignment="Center"
                              IsChecked="{Binding AutoCompleteWords, Mode=TwoWay}" />
                </Grid>
            </GroupBox>
    
            <GroupBox Grid.Row="2" Header="Mulit-key captures">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" SharedSizeGroup="LabelColumn" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Multi-key captures enabled:" 
                               VerticalAlignment="Center" Margin="5" />
                    <CheckBox Grid.Row="0" Grid.Column="1" 
                              VerticalAlignment="Center"
                              IsChecked="{Binding MultiKeySelectionEnabled, Mode=TwoWay}" />

                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Maximum number of dictionary matches:" 
                               VerticalAlignment="Center" Margin="5" />
                    <controls:NumericUpDown Grid.Row="1" Grid.Column="1" TextAlignment="Left"
                                            Minimum="1" Interval="1"
                                            Value="{Binding MultiKeySelectionMaxDictionaryMatches, Mode=TwoWay}" />
                </Grid>
            </GroupBox>
        </Grid>
    </ScrollViewer>
</UserControl>
