<Window x:Class="FLY.ControlLibrary.UI.OSK.WdNumKeyboard" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Height="400" Width="350" Background="#525a65" Loaded="Window_Loaded"> <Window.Resources> </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" /> <Setter Property="FontFamily" Value="Arial" /> </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}"/> <Setter Property="Foreground" Value="#444e57"/> </Style> <Style TargetType="Button" x:Key="ButtonStyle_opt" BasedOn="{StaticResource ButtonStyle_key}"> <Setter Property="Background" Value="{StaticResource Color_dark}"/> <Setter Property="Foreground" Value="{StaticResource Color_light}"/> </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"> <iconPacks:Material Kind="Backspace" /> </Button> <Button Grid.Row="1" Grid.Column="3" Style="{StaticResource ButtonStyle_opt}" Click="button_close_Click"> <iconPacks:Material Kind="KeyboardClose" /> </Button> <Button Grid.Row="2" Grid.Column="3" Grid.RowSpan="2" Style="{StaticResource ButtonStyle_opt}" Click="button_enter_Click"> <iconPacks:Material Kind="KeyboardReturn" /> </Button> <Button Grid.Row="3" Grid.Column="0" Style="{StaticResource ButtonStyle_opt}" Click="button_symbol_Click"> <TextBlock Text="±" Style="{StaticResource TextBlockStyle_abc}" /> </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"> <TextBlock Text="." Style="{StaticResource TextBlockStyle_abc}" /> </Button> </Grid> </Grid> </Window>