From 65f48e3069c173e3f2be4ff255d405112dd0f29f Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 7 Apr 2025 14:54:09 +0800 Subject: [PATCH] Force priority to 0 when inputing empty --- .../Resources/Controls/InstalledPluginDisplay.xaml | 1 + .../Controls/InstalledPluginDisplay.xaml.cs | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml index f57c0e2d9..ece66034c 100644 --- a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml +++ b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml @@ -71,6 +71,7 @@ Minimum="-999" SpinButtonPlacementMode="Inline" ToolTip="{DynamicResource priorityToolTip}" + ValueChanged="NumberBox_OnValueChanged" Value="{Binding Priority, Mode=TwoWay}" /> diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml.cs b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml.cs index dfa03a204..ab9496266 100644 --- a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml.cs +++ b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml.cs @@ -1,4 +1,6 @@ -namespace Flow.Launcher.Resources.Controls; +using ModernWpf.Controls; + +namespace Flow.Launcher.Resources.Controls; public partial class InstalledPluginDisplay { @@ -6,4 +8,12 @@ public partial class InstalledPluginDisplay { InitializeComponent(); } + + private void NumberBox_OnValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args) + { + if (double.IsNaN(args.NewValue)) + { + sender.Value = 0; + } + } }