|
|
@@ -0,0 +1,237 @@
|
|
|
+<Window x:Class="SKMC.UI.UserControls.NumpadControl"
|
|
|
+ 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
+ xmlns:local="clr-namespace:SKMC.UI.UserControls"
|
|
|
+ xmlns:c="clr-namespace:SKMC.UI.CustomControls"
|
|
|
+ mc:Ignorable="d"
|
|
|
+ Background="{DynamicResource Brush.Background}"
|
|
|
+ Title="数字键盘" Height="450" Width="350"
|
|
|
+ WindowStartupLocation="CenterScreen"
|
|
|
+ ResizeMode="NoResize">
|
|
|
+ <Window.Resources>
|
|
|
+ <!-- 数字按钮样式 -->
|
|
|
+ <Style x:Key="NumberButtonStyle" TargetType="Button">
|
|
|
+ <Setter Property="FontSize" Value="24"/>
|
|
|
+ <Setter Property="FontWeight" Value="Bold"/>
|
|
|
+ <Setter Property="Background" Value="#FFFFFF"/>
|
|
|
+ <Setter Property="Foreground" Value="#333333"/>
|
|
|
+ <Setter Property="BorderBrush" Value="#CCCCCC"/>
|
|
|
+ <Setter Property="BorderThickness" Value="1"/>
|
|
|
+ <Setter Property="Cursor" Value="Hand"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="Button">
|
|
|
+ <Border Background="{TemplateBinding Background}"
|
|
|
+ BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ CornerRadius="5">
|
|
|
+ <ContentPresenter HorizontalAlignment="Center"
|
|
|
+ VerticalAlignment="Center"/>
|
|
|
+ </Border>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ <Style.Triggers>
|
|
|
+ <Trigger Property="IsMouseOver" Value="True">
|
|
|
+ <Setter Property="Background" Value="#E8E8E8"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsPressed" Value="True">
|
|
|
+ <Setter Property="Background" Value="#D0D0D0"/>
|
|
|
+ </Trigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <!-- 功能按钮样式 -->
|
|
|
+ <Style x:Key="FunctionButtonStyle" TargetType="Button">
|
|
|
+ <Setter Property="FontSize" Value="18"/>
|
|
|
+ <Setter Property="FontWeight" Value="Bold"/>
|
|
|
+ <Setter Property="Background" Value="#4A90D9"/>
|
|
|
+ <Setter Property="Foreground" Value="White"/>
|
|
|
+ <Setter Property="BorderBrush" Value="#4A90D9"/>
|
|
|
+ <Setter Property="BorderThickness" Value="1"/>
|
|
|
+ <Setter Property="Cursor" Value="Hand"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="Button">
|
|
|
+ <Border Background="{TemplateBinding Background}"
|
|
|
+ BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ CornerRadius="5">
|
|
|
+ <ContentPresenter HorizontalAlignment="Center"
|
|
|
+ VerticalAlignment="Center"/>
|
|
|
+ </Border>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ <Style.Triggers>
|
|
|
+ <Trigger Property="IsMouseOver" Value="True">
|
|
|
+ <Setter Property="Background" Value="#3A7BC8"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsPressed" Value="True">
|
|
|
+ <Setter Property="Background" Value="#2A6BB8"/>
|
|
|
+ </Trigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <!-- 危险按钮样式(清空) -->
|
|
|
+ <Style x:Key="DangerButtonStyle" TargetType="Button">
|
|
|
+ <Setter Property="FontSize" Value="20"/>
|
|
|
+ <Setter Property="FontWeight" Value="Bold"/>
|
|
|
+ <Setter Property="Background" Value="#E74C3C"/>
|
|
|
+ <Setter Property="Foreground" Value="White"/>
|
|
|
+ <Setter Property="BorderBrush" Value="#E74C3C"/>
|
|
|
+ <Setter Property="BorderThickness" Value="1"/>
|
|
|
+ <Setter Property="Cursor" Value="Hand"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="Button">
|
|
|
+ <Border Background="{TemplateBinding Background}"
|
|
|
+ BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ CornerRadius="5">
|
|
|
+ <ContentPresenter HorizontalAlignment="Center"
|
|
|
+ VerticalAlignment="Center"/>
|
|
|
+ </Border>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ <Style.Triggers>
|
|
|
+ <Trigger Property="IsMouseOver" Value="True">
|
|
|
+ <Setter Property="Background" Value="#C0392B"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsPressed" Value="True">
|
|
|
+ <Setter Property="Background" Value="#A93226"/>
|
|
|
+ </Trigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <!-- 确认按钮样式 -->
|
|
|
+ <Style x:Key="ConfirmButtonStyle" TargetType="Button">
|
|
|
+ <Setter Property="FontSize" Value="20"/>
|
|
|
+ <Setter Property="FontWeight" Value="Bold"/>
|
|
|
+ <Setter Property="Background" Value="#27AE60"/>
|
|
|
+ <Setter Property="Foreground" Value="White"/>
|
|
|
+ <Setter Property="BorderBrush" Value="#27AE60"/>
|
|
|
+ <Setter Property="BorderThickness" Value="1"/>
|
|
|
+ <Setter Property="Cursor" Value="Hand"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="Button">
|
|
|
+ <Border Background="{TemplateBinding Background}"
|
|
|
+ BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ CornerRadius="5">
|
|
|
+ <ContentPresenter HorizontalAlignment="Center"
|
|
|
+ VerticalAlignment="Center"/>
|
|
|
+ </Border>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ <Style.Triggers>
|
|
|
+ <Trigger Property="IsMouseOver" Value="True">
|
|
|
+ <Setter Property="Background" Value="#219A52"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsPressed" Value="True">
|
|
|
+ <Setter Property="Background" Value="#1B8344"/>
|
|
|
+ </Trigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+ </Window.Resources>
|
|
|
+ <Grid Margin="10">
|
|
|
+ <Grid.RowDefinitions>
|
|
|
+ <RowDefinition Height="Auto"/>
|
|
|
+ <RowDefinition Height="Auto"/>
|
|
|
+ <RowDefinition Height="*"/>
|
|
|
+ </Grid.RowDefinitions>
|
|
|
+
|
|
|
+ <!-- 标题 -->
|
|
|
+ <!--<TextBlock Grid.Row="0" Text="Numpad" FontSize="24"
|
|
|
+ FontWeight="Bold" HorizontalAlignment="Center"
|
|
|
+ Margin="0,0,0,15"
|
|
|
+ Foreground="{DynamicResource Brush.Text}"/>-->
|
|
|
+
|
|
|
+ <!-- 输入框 -->
|
|
|
+ <c:SKTextBox x:Name="InputTextBox" Grid.Row="1"
|
|
|
+ FontSize="28" Height="50"
|
|
|
+ VerticalContentAlignment="Center"
|
|
|
+ TextAlignment="Right"
|
|
|
+ Margin="0,0,0,15"
|
|
|
+ IsReadOnly="True"
|
|
|
+ UnitSize="20"
|
|
|
+ Style="{StaticResource TextBox.Primary}"/>
|
|
|
+
|
|
|
+ <!-- 数字键盘 -->
|
|
|
+ <Grid Grid.Row="2">
|
|
|
+ <Grid.RowDefinitions>
|
|
|
+ <RowDefinition Height="*"/>
|
|
|
+ <RowDefinition Height="*"/>
|
|
|
+ <RowDefinition Height="*"/>
|
|
|
+ <RowDefinition Height="*"/>
|
|
|
+ </Grid.RowDefinitions>
|
|
|
+
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition Width="*"/>
|
|
|
+ <ColumnDefinition Width="*"/>
|
|
|
+ <ColumnDefinition Width="*"/>
|
|
|
+ <ColumnDefinition Width="*"/>
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+
|
|
|
+ <!-- 第一行:7, 8, 9, 清除 -->
|
|
|
+ <Button x:Name="Btn7" Grid.Row="0" Grid.Column="0"
|
|
|
+ Content="7" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="Btn8" Grid.Row="0" Grid.Column="1"
|
|
|
+ Content="8" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="Btn9" Grid.Row="0" Grid.Column="2"
|
|
|
+ Content="9" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="BtnClear" Grid.Row="0" Grid.Column="3"
|
|
|
+ Content="C" Style="{StaticResource FunctionButtonStyle}"
|
|
|
+ Click="ClearAllButton_Click" Margin="3"/>
|
|
|
+
|
|
|
+ <!-- 第二行:4, 5, 6, 退格 -->
|
|
|
+ <Button x:Name="Btn4" Grid.Row="1" Grid.Column="0"
|
|
|
+ Content="4" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="Btn5" Grid.Row="1" Grid.Column="1"
|
|
|
+ Content="5" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="Btn6" Grid.Row="1" Grid.Column="2"
|
|
|
+ Content="6" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="BtnBackspace" Grid.Row="1" Grid.Column="3"
|
|
|
+ Content="⌫" Style="{StaticResource FunctionButtonStyle}"
|
|
|
+ Click="BackspaceButton_Click" Margin="3"/>
|
|
|
+
|
|
|
+ <!-- 第三行:1, 2, 3, 复制 -->
|
|
|
+ <Button x:Name="Btn1" Grid.Row="2" Grid.Column="0"
|
|
|
+ Content="1" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="Btn2" Grid.Row="2" Grid.Column="1"
|
|
|
+ Content="2" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="Btn3" Grid.Row="2" Grid.Column="2"
|
|
|
+ Content="3" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+
|
|
|
+ <!-- 第四行:0, 小数点, +/-号, 粘贴 -->
|
|
|
+ <Button x:Name="Btn0" Grid.Row="3" Grid.Column="0"
|
|
|
+ Content="0" Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="BtnDecimal" Grid.Row="3" Grid.Column="1"
|
|
|
+ Content="." Style="{StaticResource NumberButtonStyle}"
|
|
|
+ Click="NumberButton_Click" Margin="3"/>
|
|
|
+ <Button x:Name="BtnSign" Grid.Row="2" Grid.Column="3"
|
|
|
+ Content="+/-" Style="{StaticResource FunctionButtonStyle}"
|
|
|
+ Click="SignButton_Click" Margin="3"/>
|
|
|
+
|
|
|
+ <!-- 第五行:清空,确认 -->
|
|
|
+ <Button x:Name="BtnConfirm" Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2"
|
|
|
+ Content="确认" Style="{StaticResource ConfirmButtonStyle}"
|
|
|
+ Click="ConfirmButton_Click" Margin="3"/>
|
|
|
+ </Grid>
|
|
|
+ </Grid>
|
|
|
+</Window>
|