<UserControl x:Class="JuliusSweetland.OptiKey.UI.Controls.ConversationOutput"
             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:system="clr-namespace:System;assembly=mscorlib"
             xmlns:valueConverters="clr-namespace:JuliusSweetland.OptiKey.UI.ValueConverters"
             xmlns:controls="clr-namespace:JuliusSweetland.OptiKey.UI.Controls"
             xmlns:models="clr-namespace:JuliusSweetland.OptiKey.Models"
             xmlns:enums="clr-namespace:JuliusSweetland.OptiKey.Enums"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/OptiKey;component/Resources/Icons/KeySymbols.xaml" />
                <ResourceDictionary>
                    <valueConverters:SuggestionsPaged x:Key="SuggestionsPaged" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid Background="{DynamicResource KeyDefaultBackgroundBrush}"
          Grid.IsSharedSizeScope="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <controls:Key Grid.Row="0" Grid.Column="0"
                      SymbolGeometry="{StaticResource SuggestionLeftIcon}"
                      Text="PREVIOUS"
                      SharedSizeGroup="KeyWithSymbol">
            <controls:Key.Value>
                <models:KeyValue FunctionKey="{x:Static enums:FunctionKeys.PreviousSuggestions}" />
            </controls:Key.Value>
        </controls:Key>
        <Grid Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="9">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <controls:Key Grid.Row="0" Grid.Column="0" SharedSizeGroup="KeyWithSuggestion">
                <controls:Key.Text>
                    <MultiBinding Converter="{StaticResource SuggestionsPaged}" Mode="OneWay">
                        <Binding Path="DataContext.SuggestionService.Suggestions" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding Path="DataContext.SuggestionService.SuggestionsPage" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding Path="DataContext.SuggestionService.SuggestionsPerPage" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding>
                            <Binding.Source>
                                <system:Int32>0</system:Int32>
                            </Binding.Source>
                        </Binding>
                    </MultiBinding>
                </controls:Key.Text>
                <controls:Key.Value>
                    <models:KeyValue FunctionKey="Suggestion1" />
                </controls:Key.Value>
            </controls:Key>
            <controls:Key Grid.Row="0" Grid.Column="1" SharedSizeGroup="KeyWithSuggestion">
                <controls:Key.Text>
                    <MultiBinding Converter="{StaticResource SuggestionsPaged}" Mode="OneWay">
                        <Binding Path="DataContext.SuggestionService.Suggestions" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding Path="DataContext.SuggestionService.SuggestionsPage" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding Path="DataContext.SuggestionService.SuggestionsPerPage" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding>
                            <Binding.Source>
                                <system:Int32>1</system:Int32>
                            </Binding.Source>
                        </Binding>
                    </MultiBinding>
                </controls:Key.Text>
                <controls:Key.Value>
                    <models:KeyValue FunctionKey="Suggestion2" />
                </controls:Key.Value>
            </controls:Key>
            <controls:Key Grid.Row="0" Grid.Column="2" SharedSizeGroup="KeyWithSuggestion">
                <controls:Key.Text>
                    <MultiBinding Converter="{StaticResource SuggestionsPaged}" Mode="OneWay">
                        <Binding Path="DataContext.SuggestionService.Suggestions" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding Path="DataContext.SuggestionService.SuggestionsPage" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding Path="DataContext.SuggestionService.SuggestionsPerPage" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding>
                            <Binding.Source>
                                <system:Int32>2</system:Int32>
                            </Binding.Source>
                        </Binding>
                    </MultiBinding>
                </controls:Key.Text>
                <controls:Key.Value>
                    <models:KeyValue FunctionKey="Suggestion3" />
                </controls:Key.Value>
            </controls:Key>
            <controls:Key Grid.Row="0" Grid.Column="3" SharedSizeGroup="KeyWithSuggestion">
                <controls:Key.Text>
                    <MultiBinding Converter="{StaticResource SuggestionsPaged}" Mode="OneWay">
                        <Binding Path="DataContext.SuggestionService.Suggestions" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding Path="DataContext.SuggestionService.SuggestionsPage" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding Path="DataContext.SuggestionService.SuggestionsPerPage" RelativeSource="{RelativeSource AncestorType=controls:KeyboardHost}" />
                        <Binding>
                            <Binding.Source>
                                <system:Int32>3</system:Int32>
                            </Binding.Source>
                        </Binding>
                    </MultiBinding>
                </controls:Key.Text>
                <controls:Key.Value>
                    <models:KeyValue FunctionKey="Suggestion4" />
                </controls:Key.Value>
            </controls:Key>
        </Grid>
        <controls:Key Grid.Row="0" Grid.Column="10"
                      SymbolGeometry="{StaticResource SuggestionRightIcon}"
                      Text="NEXT"
                      SharedSizeGroup="KeyWithSymbol">
            <controls:Key.Value>
                <models:KeyValue FunctionKey="{x:Static enums:FunctionKeys.NextSuggestions}" />
            </controls:Key.Value>
        </controls:Key>

        <controls:Key Grid.Row="1" Grid.Column="0"
                      SymbolGeometry="{StaticResource AddToDictionaryIcon}" 
                      Text="ADD TO&#x0a;DICTIONARY"
                      SharedSizeGroup="KeyWithSymbol">
            <controls:Key.Value>
                <models:KeyValue FunctionKey="{x:Static enums:FunctionKeys.AddToDictionary}" />
            </controls:Key.Value>
        </controls:Key>
        <controls:Key Grid.Row="1" Grid.Column="1"
                      SymbolGeometry="{StaticResource ClearIcon}" 
                      Text="CLEAR"
                      SharedSizeGroup="KeyWithSymbol">
            <controls:Key.Value>
                <models:KeyValue FunctionKey="{x:Static enums:FunctionKeys.ClearScratchpad}" />
            </controls:Key.Value>
        </controls:Key>
        <controls:Scratchpad Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="7"
                             Text="{Binding DataContext.KeyboardOutputService.Text, RelativeSource={RelativeSource AncestorType=controls:KeyboardHost}, Mode=OneWay}" />
        <controls:Key Grid.Row="1" Grid.Column="9"
                      SymbolGeometry="{StaticResource SpeakIcon}" 
                      Text="SPEAK"
                      SharedSizeGroup="KeyWithSymbol">
            <controls:Key.Value>
                <models:KeyValue FunctionKey="{x:Static enums:FunctionKeys.Speak}" />
            </controls:Key.Value>
        </controls:Key>
        <controls:Key Grid.Row="1" Grid.Column="10"
                      SymbolGeometry="{StaticResource CalibrateIcon}"
                      Text="RE-CALIBRATE"
                      SharedSizeGroup="KeyWithSymbol">
            <controls:Key.Value>
                <models:KeyValue FunctionKey="{x:Static enums:FunctionKeys.Calibrate}" />
            </controls:Key.Value>
        </controls:Key>
    </Grid>
</UserControl>
