diff --git a/src/Wpf.Ui.Gallery/ViewModels/Pages/Text/NumberBoxViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Pages/Text/NumberBoxViewModel.cs
index 2203f05bc..8bd4feb3d 100644
--- a/src/Wpf.Ui.Gallery/ViewModels/Pages/Text/NumberBoxViewModel.cs
+++ b/src/Wpf.Ui.Gallery/ViewModels/Pages/Text/NumberBoxViewModel.cs
@@ -3,6 +3,35 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
+using Wpf.Ui.Controls;
+
namespace Wpf.Ui.Gallery.ViewModels.Pages.Text;
-public partial class NumberBoxViewModel : ViewModel;
+public partial class NumberBoxViewModel : ViewModel
+{
+ private int _numberBoxSpinButtonPlacementModeSelectedIndex = 2;
+
+ public int NumberBoxSpinButtonPlacementModeSelectedIndex
+ {
+ get => _numberBoxSpinButtonPlacementModeSelectedIndex;
+ set
+ {
+ _ = SetProperty(ref _numberBoxSpinButtonPlacementModeSelectedIndex, value);
+
+ UpdateSpinButtonPlacementMode(value);
+ }
+ }
+
+ [ObservableProperty]
+ private NumberBoxSpinButtonPlacementMode _spinButtonPlacementMode = NumberBoxSpinButtonPlacementMode.Inline;
+
+ private void UpdateSpinButtonPlacementMode(int placementModeIndex)
+ {
+ SpinButtonPlacementMode = placementModeIndex switch
+ {
+ 0 => NumberBoxSpinButtonPlacementMode.Hidden,
+ 1 => NumberBoxSpinButtonPlacementMode.Compact,
+ _ => NumberBoxSpinButtonPlacementMode.Inline,
+ };
+ }
+}
\ No newline at end of file
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Text/NumberBoxPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Text/NumberBoxPage.xaml
index 8aa463e48..64d9b682b 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Text/NumberBoxPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Text/NumberBoxPage.xaml
@@ -6,7 +6,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wpf.Ui.Gallery.Views.Pages.Text"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="NumberBoxPage"
controls:PageControlDocumentation.DocumentationType="{x:Type ui:NumberBox}"
@@ -27,6 +26,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/src/Wpf.Ui/Controls/NumberBox/NumberBox.cs b/src/Wpf.Ui/Controls/NumberBox/NumberBox.cs
index 89b7048f0..eac2f6751 100644
--- a/src/Wpf.Ui/Controls/NumberBox/NumberBox.cs
+++ b/src/Wpf.Ui/Controls/NumberBox/NumberBox.cs
@@ -27,9 +27,13 @@ public partial class NumberBox : Wpf.Ui.Controls.TextBox
{
// Template part names
private const string PART_ClearButton = nameof(PART_ClearButton);
+ private const string PART_CompactIncrementDecrementButton = nameof(PART_CompactIncrementDecrementButton);
+ private const string PART_CompactIncrementDecrementFlyout = nameof(PART_CompactIncrementDecrementFlyout);
+ private const string PART_CompactIncrementButton = nameof(PART_CompactIncrementButton);
+ private const string PART_CompactDecrementButton = nameof(PART_CompactDecrementButton);
private const string PART_InlineIncrementButton = nameof(PART_InlineIncrementButton);
private const string PART_InlineDecrementButton = nameof(PART_InlineDecrementButton);
-
+
private bool _valueUpdating;
/// Identifies the dependency property.
@@ -330,6 +334,9 @@ public override void OnApplyTemplate()
PART_ClearButton,
() => OnClearButtonClick()
);
+ SubscribeToButtonClickEvent(PART_CompactIncrementDecrementButton, () => OnCompactIncrementDecrementButtonClick());
+ SubscribeToButtonClickEvent(PART_CompactIncrementButton, () => StepValue(SmallChange));
+ SubscribeToButtonClickEvent(PART_CompactDecrementButton, () => StepValue(-SmallChange));
SubscribeToButtonClickEvent(PART_InlineIncrementButton, () => StepValue(SmallChange));
SubscribeToButtonClickEvent(PART_InlineDecrementButton, () => StepValue(-SmallChange));
@@ -346,6 +353,14 @@ public override void OnApplyTemplate()
base.OnApplyTemplate();
}
+ private void OnCompactIncrementDecrementButtonClick()
+ {
+ if (GetTemplateChild(PART_CompactIncrementDecrementFlyout) is Flyout flyout)
+ {
+ flyout.IsOpen = true;
+ }
+ }
+
private void SubscribeToButtonClickEvent(string elementName, Action action)
where TButton : ButtonBase
{
diff --git a/src/Wpf.Ui/Controls/NumberBox/NumberBox.xaml b/src/Wpf.Ui/Controls/NumberBox/NumberBox.xaml
index d0c6cd267..6e66f88d2 100644
--- a/src/Wpf.Ui/Controls/NumberBox/NumberBox.xaml
+++ b/src/Wpf.Ui/Controls/NumberBox/NumberBox.xaml
@@ -124,6 +124,41 @@
IsTabStop="False">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -196,8 +232,15 @@
+
+
+
+
+
+
+
@@ -256,4 +299,4 @@
-
+
\ No newline at end of file