<UserControl x:Class="HistoryView.Controls.Input.TextboxKeyboard"
             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:local="clr-namespace:HistoryView.Controls.Input"
             xmlns:resources="clr-namespace:HistoryView.Resources"
             mc:Ignorable="d" 
             x:Name="This"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <Style  TargetType="CheckBox">
            <Setter Property="Margin" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="CheckBox">
                        <Border x:Name="bor"  Margin="{TemplateBinding Margin}" CornerRadius="4">
                            <ContentPresenter Panel.ZIndex="0"  VerticalAlignment="Center" HorizontalAlignment="Center" TextElement.Foreground="{StaticResource TextColor}" Margin="12,6"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter Property="Background" TargetName="bor" Value="{StaticResource NiceGreen}"/>
                            </Trigger>
                            <Trigger Property="IsChecked" Value="False">
                                <Setter Property="Background" TargetName="bor" Value="{StaticResource DisableColor}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid>
        <ContentPresenter x:Name="presenter" TouchLeave="TextBox_GotFocus" Content="{Binding ElementName=This, Path=DisplayContent}"/>

        <Popup x:Name="PopKeyboard" AllowsTransparency="True" PopupAnimation="Slide" PlacementTarget="{Binding ElementName=presenter}" HorizontalOffset="-400" VerticalOffset="16">
            <Border BorderBrush="{StaticResource ThemeColor}" BorderThickness="4" CornerRadius="4" Background="{StaticResource BackgroundColor}">
                <Border.Effect>
                    <DropShadowEffect BlurRadius="20" Color="Black" Opacity="0.6"  ShadowDepth="6"/>
                </Border.Effect>
                <Grid Width="auto">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="4"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="0"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <Border x:Name="Preview" Background="{StaticResource LightThemeColor}" CornerRadius="4,4,0,0" >
                        <StackPanel Margin="8" Orientation="Horizontal" HorizontalAlignment="Center">
                            <TextBlock Foreground="Red" FontSize="16" FontWeight="Bold" VerticalAlignment="Center">|</TextBlock>
                            <TextBlock  FontSize="14" VerticalAlignment="Center" Text="{Binding ElementName=This, Path=Display}"/>
                            <TextBlock Foreground="Red" FontSize="16" FontWeight="Bold" VerticalAlignment="Center">|</TextBlock>
                        </StackPanel>
                    </Border>
                    <Border x:Name="Selection" Grid.Row="2" Background="{StaticResource BackgroundColor}">
                        <resources:TouchableScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Left" HorizontalScrollBarVisibility="Hidden" MaxWidth="1000">
                            <ItemsControl ItemsSource="{Binding ElementName=This,Path=Filtered}" Margin="0,8">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <Button Style="{StaticResource FunctionButton}" Background="{StaticResource SubThemeColor}" Margin="8,2" Click="Select" Content="{Binding}"/>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal"/>
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </resources:TouchableScrollViewer>

                    </Border>
                    <StackPanel Grid.Row="4" TextElement.FontSize="16" TextElement.FontWeight="Bold">

                        <Grid Margin="8,4">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Button Grid.Column="0" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">!</Button>
                            <Button Grid.Column="2" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">@</Button>
                            <Button Grid.Column="4" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">#</Button>
                            <Button Grid.Column="6" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">$</Button>
                            <Button Grid.Column="8" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">%</Button>
                            <Button Grid.Column="10" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">^</Button>
                            <Button Grid.Column="12" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">&amp;</Button>
                            <Button Grid.Column="14" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">*</Button>
                            <Button Grid.Column="16" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">(</Button>
                            <Button Grid.Column="18" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">)</Button>
                            <Button Grid.Column="20" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">-</Button>
                            <Button Grid.Column="22" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">+</Button>
                            <Button Grid.Column="24" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">|</Button>
                            <Button Grid.Column="26" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">\</Button>
                            <Button Grid.Column="28" Style="{StaticResource FunctionButton}"  Click="Clear"  Background="{StaticResource WarningColor}">Clear</Button>
                        </Grid>

                        <Grid Margin="8,4" Height="40">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0"/>
                                <ColumnDefinition Width="0"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Border Grid.Column="0" CornerRadius="4" Background="{StaticResource DisableColor}"/>
                            <Button Grid.Column="2" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"    TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">~</Button>
                            <Button Grid.Column="4"  Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">1</Button>
                            <Button Grid.Column="6"  Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">2</Button>
                            <Button Grid.Column="8"  Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">3</Button>
                            <Button Grid.Column="10"  Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"  TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">4</Button>
                            <Button Grid.Column="12"  Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"  TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">5</Button>
                            <Button Grid.Column="14" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">6</Button>
                            <Button Grid.Column="16" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">7</Button>
                            <Button Grid.Column="18" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">8</Button>
                            <Button Grid.Column="20" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">9</Button>
                            <Button Grid.Column="22" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">0</Button>
                            <Button Grid.Column="24" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">_</Button>
                            <Button Grid.Column="26" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">=</Button>
                            <Button Grid.Column="28" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"  Click="Delete">BackSpace</Button>
                        </Grid>

                        <Grid Margin="8,4" Height="40" x:Name="Line1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Border Grid.Column="0" CornerRadius="4" Background="{StaticResource LightDisableColor}"/>

                            <Button Grid.Column="2" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">q</Button>
                            <Button Grid.Column="4" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">w</Button>
                            <Button Grid.Column="6" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">e</Button>
                            <Button Grid.Column="8" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">r</Button>
                            <Button Grid.Column="10" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"  TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">t</Button>
                            <Button Grid.Column="12" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">y</Button>
                            <Button Grid.Column="14" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">u</Button>
                            <Button Grid.Column="16" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">i</Button>
                            <Button Grid.Column="18" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">o</Button>
                            <Button Grid.Column="20" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">p</Button>
                            <Button Grid.Column="22" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">[</Button>
                            <Button Grid.Column="24" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">]</Button>
                            <Button Grid.Column="26" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">{</Button>
                            <Button Grid.Column="28" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">}</Button>
                            <Border Grid.Column="30" CornerRadius="4" Background="{StaticResource LightDisableColor}"/>


                        </Grid>

                        <Grid Margin="8,4" Height="40" x:Name="Line2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                            </Grid.ColumnDefinitions>

                            <CheckBox Grid.Column="0" IsChecked="{Binding ElementName=This, Path=IsCaps}" Background="{StaticResource ThemeColor}">Caps</CheckBox>
                            <Button Grid.Column="2" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">a</Button>
                            <Button Grid.Column="4" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">s</Button>
                            <Button Grid.Column="6" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">d</Button>
                            <Button Grid.Column="8" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">f</Button>
                            <Button Grid.Column="10" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"  TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">g</Button>
                            <Button Grid.Column="12" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">h</Button>
                            <Button Grid.Column="14" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">j</Button>
                            <Button Grid.Column="16" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">k</Button>
                            <Button Grid.Column="18" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">l</Button>
                            <Button Grid.Column="20" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">;</Button>
                            <Button Grid.Column="22" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">'</Button>
                            <Button Grid.Column="24" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">:</Button>
                            <Button Grid.Column="26" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">"</Button>
                            <Button Grid.Column="28" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">?</Button>


                        </Grid>

                        <Grid Margin="8,4" Height="40" x:Name="Line3">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="42"/>
                                <ColumnDefinition Width="8"/>

                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <CheckBox Grid.Column="0" IsChecked="{Binding ElementName=This, Path=IsShift}" Background="{StaticResource ThemeColor}">Shift</CheckBox>

                            <Button Grid.Column="2" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">z</Button>
                            <Button Grid.Column="4" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">x</Button>
                            <Button Grid.Column="6" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">c</Button>
                            <Button Grid.Column="8" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">v</Button>
                            <Button Grid.Column="10" Style="{StaticResource FunctionButton}"  Background="{StaticResource ThemeColor}"  TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">b</Button>
                            <Button Grid.Column="12" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">n</Button>
                            <Button Grid.Column="14" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">m</Button>
                            <Button Grid.Column="16" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">,</Button>
                            <Button Grid.Column="18" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">.</Button>
                            <Button Grid.Column="20" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">/</Button>
                            <Button Grid.Column="22" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">&lt;</Button>
                            <Button Grid.Column="24" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}"   TouchDown="Button_TouchDown" TouchLeave="Button_TouchLeave" Click="SendKey">&gt;</Button>
                            <CheckBox Grid.Column="26" IsChecked="{Binding ElementName=This, Path=IsShift}" Background="{StaticResource ThemeColor}">Shift</CheckBox>

                        </Grid>

                        <Grid Margin="8,4" Height="40">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="8"/>
                                <ColumnDefinition Width="100"/>
                            </Grid.ColumnDefinitions>
                            <Button x:Name="Cancel" Grid.Column="0" Style="{StaticResource FunctionButton}"  Click="CancelConfirm" CommandParameter="Cancel" Background="{StaticResource EmergencyColor}">取消</Button>
                            <Button Grid.Column="2" Style="{StaticResource FunctionButton}" Background="{StaticResource ThemeColor}" Click="SendKey">Space</Button>
                            <Button Grid.Column="4" Style="{StaticResource FunctionButton}"  Click="CancelConfirm" CommandParameter="Confirm" Background="{StaticResource NiceGreen}">确定</Button>
                        </Grid>

                    </StackPanel>
                </Grid>
            </Border>
        </Popup>

        <Popup x:Name="Hint" Placement="Top" VerticalOffset="-16" AllowsTransparency="True">
            <Border Background="White" Width="50" Height="40" CornerRadius="8">
                <TextBlock x:Name="HintText" FontSize="24" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="Black"/>
            </Border>
        </Popup>
    </Grid>
</UserControl>
