feat: use repeat button
This commit is contained in:
@@ -6,66 +6,68 @@
|
|||||||
<ControlTheme x:Key="{x:Type u:NumPad}" TargetType="{x:Type u:NumPad}">
|
<ControlTheme x:Key="{x:Type u:NumPad}" TargetType="{x:Type u:NumPad}">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="u:NumPad">
|
<ControlTemplate TargetType="u:NumPad">
|
||||||
<Border Padding="48">
|
<Border>
|
||||||
<Border.Styles>
|
<Border.Styles>
|
||||||
<Style Selector="Button">
|
<Style Selector="RepeatButton">
|
||||||
<Setter Property="Command" Value="{Binding $parent[u:NumPad].InputNumber}" />
|
<Setter Property="Command" Value="{Binding $parent[u:NumPad].InputNumber}" />
|
||||||
<Setter Property="CommandParameter" Value="{Binding $self.Content}" />
|
<Setter Property="CommandParameter" Value="{Binding $self.Content}" />
|
||||||
|
<Setter Property="Width" Value="48"/>
|
||||||
|
<Setter Property="Height" Value="48"/>
|
||||||
</Style>
|
</Style>
|
||||||
</Border.Styles>
|
</Border.Styles>
|
||||||
<Grid ColumnDefinitions="*,*,*" RowDefinitions="*,*,*,*">
|
<Grid ColumnDefinitions="*,*,*" RowDefinitions="*,*,*,*">
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="7"
|
Content="7"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Content="8"
|
Content="8"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Content="9"
|
Content="9"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="4"
|
Content="4"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Content="5"
|
Content="5"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Content="6"
|
Content="6"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="1"
|
Content="1"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Content="2"
|
Content="2"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Content="3"
|
Content="3"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="0"
|
Content="0"
|
||||||
Focusable="False" />
|
Focusable="False" />
|
||||||
<Button
|
<RepeatButton
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Content="."
|
Content="."
|
||||||
|
|||||||
@@ -60,12 +60,7 @@ public class NumPad: TemplatedControl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var numPad = new NumPad() { Target = sender as InputElement };
|
var numPad = new NumPad() { Target = sender as InputElement };
|
||||||
OverlayDialog.ShowCustom(numPad, new object());
|
OverlayDialog.Show(numPad, new object(), options: new OverlayDialogOptions() { Buttons = DialogButton.None });
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnApplyTemplate(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSevenButtonClick(object sender, RoutedEventArgs e)
|
private void OnSevenButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user