<UserControl
    x:Class="BPASmartClient.CustomResource.UserControls.UserKeyBoard"
    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:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    x:Name="Keyboard"
    d:DesignHeight="180"
    d:DesignWidth="500"
    Background="Transparent"
    mc:Ignorable="d">
    <UserControl.Resources>
        <Style x:Key="btnNum" TargetType="{x:Type Button}">
            <Setter Property="Cursor" Value="Hand"></Setter>
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border
                            x:Name="border"
                            BorderBrush="#FF474747"
                            BorderThickness="1"
                            CornerRadius="6">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Color="#002A5F" />
                                    <GradientStop Offset="1" Color="#6495ED" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <ContentPresenter
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                TextElement.FontSize="16"
                                TextElement.Foreground="#4fade8" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="border" Property="Background">
                                    <Setter.Value>
                                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                            <GradientStop Color="#FFFF7500" />
                                            <GradientStop Offset="1" Color="#FFFFC547" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="False">
                                <Setter TargetName="border" Property="Background">
                                    <Setter.Value>
                                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                            <GradientStop Color="#002A5F" />
                                            <GradientStop Offset="1" Color="#6495ED" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>

                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="btnFunc" TargetType="{x:Type Button}">
            <Setter Property="Cursor" Value="Hand"></Setter>
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <!--<Setter Property="Padding" Value="1"/>-->
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border
                            x:Name="border"
                            BorderBrush="#FF565656"
                            BorderThickness="1"
                            CornerRadius="6">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Color="#002A5F" />
                                    <GradientStop Offset="1" Color="#6495ED" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <ContentPresenter
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                TextElement.FontSize="18"
                                TextElement.Foreground="White" />

                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="border" Property="Background">
                                    <Setter.Value>
                                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                            <GradientStop Offset="1" Color="Gray" />
                                            <GradientStop Offset="0" Color="#FF2D2D2D" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <UserControl.Triggers>
        <EventTrigger RoutedEvent="UserControl.Loaded" SourceName="Keyboard">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation
                        Storyboard.TargetName="Keyboard"
                        Storyboard.TargetProperty="Opacity"
                        From="0"
                        To="1"
                        Duration="0:0:0.2" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </UserControl.Triggers>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="10" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="10" />
            </Grid.ColumnDefinitions>
            <Grid
                x:Name="ButtonGrid"
                Grid.Row="1"
                Grid.Column="1"
                ButtonBase.Click="ButtonGrid_Click">
                <Grid.RowDefinitions>
                    <RowDefinition Height="80*" />
                    <RowDefinition Height="80*" />
                    <RowDefinition Height="80*" />
                    <RowDefinition Height="80*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                    <ColumnDefinition Width="120*" />
                </Grid.ColumnDefinitions>
                <Button
                    Grid.Row="0"
                    Grid.Column="0"
                    Margin="2"
                    Content="1"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="1"
                    Margin="2"
                    Content="2"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="2"
                    Margin="2"
                    Content="3"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="3"
                    Margin="2"
                    Content="4"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="4"
                    Margin="2"
                    Content="5"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="5"
                    Margin="2"
                    Content="6"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="6"
                    Margin="2"
                    Content="7"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="7"
                    Margin="2"
                    Content="8"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="8"
                    Margin="2"
                    Content="9"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="0"
                    Grid.Column="9"
                    Margin="2"
                    Content="0"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="0"
                    Margin="2"
                    Content="Q"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="1"
                    Margin="2"
                    Content="W"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="2"
                    Margin="2"
                    Content="E"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="3"
                    Margin="2"
                    Content="R"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="4"
                    Margin="2"
                    Content="T"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="5"
                    Margin="2"
                    Content="Y"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="6"
                    Margin="2"
                    Content="U"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="7"
                    Margin="2"
                    Content="I"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="8"
                    Margin="2"
                    Content="O"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="1"
                    Grid.Column="9"
                    Margin="2"
                    Content="P"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="0"
                    Margin="2"
                    Content="A"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="1"
                    Margin="2"
                    Content="S"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="2"
                    Margin="2"
                    Content="D"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="3"
                    Margin="2"
                    Content="F"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="4"
                    Margin="2"
                    Content="G"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="5"
                    Margin="2"
                    Content="H"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="6"
                    Margin="2"
                    Content="J"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="7"
                    Margin="2"
                    Content="K"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="8"
                    Margin="2"
                    Content="L"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="0"
                    Margin="2"
                    Content="Z"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="1"
                    Margin="2"
                    Content="X"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="2"
                    Margin="2"
                    Content="C"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="3"
                    Margin="2"
                    Content="V"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="4"
                    Margin="2"
                    Content="B"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="5"
                    Margin="2"
                    Content="N"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="6"
                    Margin="2"
                    Content="M"
                    Style="{StaticResource btnNum}" />
                <Button
                    Grid.Row="2"
                    Grid.Column="9"
                    Margin="2"
                    Content="A/a"
                    Style="{StaticResource btnFunc}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="7"
                    Margin="2"
                    Content="DEL"
                    Style="{StaticResource btnFunc}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="8"
                    Margin="2"
                    Content="AC"
                    Style="{StaticResource btnFunc}" />
                <Button
                    Grid.Row="3"
                    Grid.Column="9"
                    Margin="2"
                    Content="确认"
                    Style="{StaticResource btnFunc}" />

            </Grid>
        </Grid>
    </Grid>
</UserControl>
