Skip to content

Commit 590b4c8

Browse files
committed
Try NumberBox
1 parent 669f3ef commit 590b4c8

3 files changed

Lines changed: 39 additions & 28 deletions

File tree

Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
</None>
5151
</ItemGroup>
5252

53+
<ItemGroup>
54+
<PackageReference Include="iNKORE.UI.WPF.Modern" Version="0.10.2.1">
55+
<PrivateAssets>all</PrivateAssets>
56+
</PackageReference>
57+
</ItemGroup>
58+
5359
<ItemGroup>
5460
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
5561
</ItemGroup>

Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ public int MaxSuggestions
213213
{
214214
if (maxSuggestions != value)
215215
{
216-
maxSuggestions = Math.Max(1, Math.Min(value, 10));
217-
OnPropertyChanged(nameof(MaxSuggestions));
216+
maxSuggestions = value;
217+
OnPropertyChanged();
218218
}
219219
}
220220
}

Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
67
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
79
xmlns:vm="clr-namespace:Flow.Launcher.Plugin.WebSearch"
810
d:DataContext="{d:DesignInstance vm:SettingsViewModel}"
911
d:DesignHeight="300"
@@ -45,17 +47,17 @@
4547
x:Name="SearchSourcesListView"
4648
Grid.Row="0"
4749
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
50+
AllowDrop="True"
4851
BorderBrush="DarkGray"
4952
BorderThickness="1"
53+
Drop="ListView_Drop"
5054
GridViewColumnHeader.Click="SortByColumn"
5155
ItemsSource="{Binding Settings.SearchSources}"
5256
MouseDoubleClick="MouseDoubleClickItem"
53-
SelectedItem="{Binding Settings.SelectedSearchSource}"
54-
SizeChanged="ListView_SizeChanged"
5557
PreviewMouseLeftButtonDown="ListView_PreviewMouseLeftButtonDown"
5658
PreviewMouseMove="ListView_PreviewMouseMove"
57-
AllowDrop="True"
58-
Drop="ListView_Drop"
59+
SelectedItem="{Binding Settings.SelectedSearchSource}"
60+
SizeChanged="ListView_SizeChanged"
5961
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
6062
<ListView.View>
6163
<GridView>
@@ -146,45 +148,48 @@
146148

147149
<Separator Grid.Row="2" Style="{StaticResource SettingPanelSeparatorStyle}" />
148150

149-
<DockPanel
151+
<StackPanel
150152
Grid.Row="3"
151-
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
152-
HorizontalAlignment="Right">
153-
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
154-
<Label
153+
HorizontalAlignment="Right"
154+
Orientation="Vertical">
155+
<StackPanel Orientation="Horizontal">
156+
<TextBlock
157+
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
155158
HorizontalAlignment="Right"
156159
VerticalAlignment="Center"
157-
Content="{DynamicResource flowlauncher_plugin_websearch_max_suggestions}" />
158-
<TextBox
159-
Width="40"
160-
Height="30"
161-
Margin="{StaticResource SettingPanelItemLeftMargin}"
162-
VerticalAlignment="Center"
163-
HorizontalAlignment="Center"
164-
TextAlignment="Center"
165-
FontSize="11"
166-
Text="{Binding Settings.MaxSuggestions, UpdateSourceTrigger=PropertyChanged}" />
167-
<Label
160+
Text="{DynamicResource flowlauncher_plugin_websearch_max_suggestions}" />
161+
<ui:NumberBox
162+
Width="120"
163+
MinWidth="120"
164+
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
165+
Maximum="1000"
166+
Minimum="1"
167+
SmallChange="10"
168+
SpinButtonPlacementMode="Compact"
169+
ValidationMode="InvalidInputOverwritten"
170+
Value="{Binding Settings.MaxSuggestions, Mode=TwoWay}" />
171+
</StackPanel>
172+
<StackPanel Orientation="Horizontal">
173+
<TextBlock
174+
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
168175
HorizontalAlignment="Right"
169176
VerticalAlignment="Center"
170-
Margin="{StaticResource SettingPanelItemLeftMargin}"
171-
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion_provider}" />
177+
Text="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion_provider}" />
172178
<ComboBox
173179
Height="30"
174-
Margin="{StaticResource SettingPanelItemLeftMargin}"
180+
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
175181
VerticalAlignment="Center"
176-
FontSize="11"
177182
IsEnabled="{Binding Settings.EnableSuggestion}"
178183
ItemsSource="{Binding Settings.Suggestions}"
179184
SelectedItem="{Binding Settings.SelectedSuggestion}" />
180185
<CheckBox
181186
Name="EnableSuggestion"
182-
Margin="{StaticResource SettingPanelItemLeftMargin}"
187+
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
183188
HorizontalAlignment="Right"
184189
VerticalAlignment="Center"
185190
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}"
186191
IsChecked="{Binding Settings.EnableSuggestion}" />
187192
</StackPanel>
188-
</DockPanel>
193+
</StackPanel>
189194
</Grid>
190195
</UserControl>

0 commit comments

Comments
 (0)