WdNumKeyboard.xaml 7.89 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1
<Window x:Class="FLY.ControlLibrary.UI.OSK.WdNumKeyboard"
潘栩锋's avatar
潘栩锋 committed
2 3
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
潘栩锋's avatar
潘栩锋 committed
4
        xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
潘栩锋's avatar
潘栩锋 committed
5
        WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
潘栩锋's avatar
潘栩锋 committed
6
        Height="400" Width="350" Background="#525a65" Loaded="Window_Loaded">
潘栩锋's avatar
潘栩锋 committed
7
    <Window.Resources>
潘栩锋's avatar
潘栩锋 committed
8

潘栩锋's avatar
潘栩锋 committed
9 10 11 12 13 14 15
    </Window.Resources>
    <Grid>
        <Grid.Resources>
            <SolidColorBrush x:Key="Color_light" Color="#f4f4f4"/>
            <SolidColorBrush x:Key="Color_dark" Color="#8e9aa8"/>
            <Style TargetType="TextBlock" x:Key="TextBlockStyle_abc">
                <Setter Property="FontSize"  Value="20" />
16
                <Setter Property="FontFamily"  Value="Arial" />
潘栩锋's avatar
潘栩锋 committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
            </Style>
            <Style TargetType="Button" x:Key="ButtonStyle_key">
                <Setter Property="Margin" Value="3"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <StackPanel Orientation="Vertical">
                                <Border Background="{TemplateBinding Background}" Height="{TemplateBinding ActualHeight}" Width="{TemplateBinding ActualWidth}" BorderThickness="2" CornerRadius="3">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="50*"/>
                                            <RowDefinition Height="150*"/>
                                            <RowDefinition Height="50*"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="50*"/>
                                            <ColumnDefinition Width="150*"/>
                                            <ColumnDefinition Width="50*"/>
                                        </Grid.ColumnDefinitions>
                                        <Viewbox Grid.Row="1" Grid.Column="1" >
                                            <ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                        </Viewbox>
                                    </Grid>

                                </Border>
                            </StackPanel>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsKeyboardFocused" Value="true">
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                </Trigger>
                                <Trigger Property="IsPressed" Value="true">
                                    <Setter Property="Opacity" Value="0.5"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="Button" x:Key="ButtonStyle_abc" BasedOn="{StaticResource ButtonStyle_key}">
                <Setter Property="Background" Value="{StaticResource Color_light}"/>
潘栩锋's avatar
潘栩锋 committed
58
                <Setter Property="Foreground" Value="#444e57"/>
潘栩锋's avatar
潘栩锋 committed
59 60 61
            </Style>
            <Style TargetType="Button" x:Key="ButtonStyle_opt" BasedOn="{StaticResource ButtonStyle_key}">
                <Setter Property="Background" Value="{StaticResource Color_dark}"/>
潘栩锋's avatar
潘栩锋 committed
62
                <Setter Property="Foreground" Value="{StaticResource Color_light}"/>
潘栩锋's avatar
潘栩锋 committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="57*" />
            <RowDefinition Height="200*" />
        </Grid.RowDefinitions>
        <Border Background="White" Margin="6" CornerRadius="3" MouseDown="Border_MouseDown">
            <Viewbox Margin="3" HorizontalAlignment="Right" VerticalAlignment="Center" >
                <TextBlock x:Name="textblock_result" Text="{Binding Result}" Foreground="Black" FontWeight="Bold" FontSize="30" />
            </Viewbox>
        </Border>
        <Grid Grid.Row="1" Margin="3">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition  />
                <RowDefinition  />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <Button Grid.Row="0" Grid.Column="0" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="7" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="0" Grid.Column="1" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="8" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="0" Grid.Column="2" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="9" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="1" Grid.Column="0" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="4" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="1" Grid.Column="1" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="5" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="1" Grid.Column="2" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="6" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="2" Grid.Column="0" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="1" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="2" Grid.Column="1" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="2" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="2" Grid.Column="2" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="3" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="0" Grid.Column="3" Style="{StaticResource ButtonStyle_opt}" Click="button_backspace_Click">
潘栩锋's avatar
潘栩锋 committed
116
                <iconPacks:Material Kind="Backspace"  />
潘栩锋's avatar
潘栩锋 committed
117 118
            </Button>
            <Button Grid.Row="1" Grid.Column="3" Style="{StaticResource ButtonStyle_opt}" Click="button_close_Click">
潘栩锋's avatar
潘栩锋 committed
119
                <iconPacks:Material Kind="KeyboardClose"  />
潘栩锋's avatar
潘栩锋 committed
120 121
            </Button>
            <Button Grid.Row="2" Grid.Column="3" Grid.RowSpan="2" Style="{StaticResource ButtonStyle_opt}" Click="button_enter_Click">
潘栩锋's avatar
潘栩锋 committed
122
                <iconPacks:Material Kind="KeyboardReturn"  />
潘栩锋's avatar
潘栩锋 committed
123 124
            </Button>
            <Button Grid.Row="3" Grid.Column="0" Style="{StaticResource ButtonStyle_opt}" Click="button_symbol_Click">
潘栩锋's avatar
潘栩锋 committed
125
                <TextBlock Text="±" Style="{StaticResource TextBlockStyle_abc}" />
潘栩锋's avatar
潘栩锋 committed
126 127 128 129 130
            </Button>
            <Button Grid.Row="3" Grid.Column="1" Style="{StaticResource ButtonStyle_abc}" Click="button_Click">
                <TextBlock Text="0" Style="{StaticResource TextBlockStyle_abc}" />
            </Button>
            <Button Grid.Row="3" Grid.Column="2" Style="{StaticResource ButtonStyle_opt}" Click="button_Click">
潘栩锋's avatar
潘栩锋 committed
131
                <TextBlock Text="." Style="{StaticResource TextBlockStyle_abc}" />
潘栩锋's avatar
潘栩锋 committed
132 133 134 135
            </Button>
        </Grid>

    </Grid>
潘栩锋's avatar
潘栩锋 committed
136
</Window>