feat: implement more buttons.

This commit is contained in:
rabbitism
2024-03-09 19:28:18 +08:00
parent 51d7c3c870
commit 24dd00d552
4 changed files with 81 additions and 11 deletions

View File

@@ -1,12 +1,77 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type u:NumPad}" TargetType="{x:Type u:NumPad}">
<Setter Property="Template">
<ControlTemplate TargetType="u:NumPad">
<Border Padding="48">
<Button Focusable="False" Name="{x:Static u:NumPad.PART_Seven}" Content="7" Width="32"></Button>
<Border.Styles>
<Style Selector="Button">
<Setter Property="Command" Value="{Binding $parent[u:NumPad].InputNumber}" />
<Setter Property="CommandParameter" Value="{Binding $self.Content}" />
</Style>
</Border.Styles>
<Grid ColumnDefinitions="*,*,*" RowDefinitions="*,*,*,*">
<Button
Grid.Row="0"
Grid.Column="0"
Content="7"
Focusable="False" />
<Button
Grid.Row="0"
Grid.Column="1"
Content="8"
Focusable="False" />
<Button
Grid.Row="0"
Grid.Column="2"
Content="9"
Focusable="False" />
<Button
Grid.Row="1"
Grid.Column="0"
Content="4"
Focusable="False" />
<Button
Grid.Row="1"
Grid.Column="1"
Content="5"
Focusable="False" />
<Button
Grid.Row="1"
Grid.Column="2"
Content="6"
Focusable="False" />
<Button
Grid.Row="2"
Grid.Column="0"
Content="1"
Focusable="False" />
<Button
Grid.Row="2"
Grid.Column="1"
Content="2"
Focusable="False" />
<Button
Grid.Row="2"
Grid.Column="2"
Content="3"
Focusable="False" />
<Button
Grid.Row="3"
Grid.ColumnSpan="2"
Grid.Column="0"
Content="0"
Focusable="False" />
<Button
Grid.Row="3"
Grid.Column="2"
Content="."
Focusable="False" />
</Grid>
</Border>
</ControlTemplate>
</Setter>