mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Make the number of results show at a time customizable
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<UserControl x:Class="Wox.ResultPanel"
|
||||
x:Name="Results"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -6,8 +7,7 @@
|
||||
xmlns:converters="clr-namespace:Wox.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100">
|
||||
|
||||
<!-- set max height of listbox to allow 6 results showed at once -->
|
||||
<ListBox x:Name="lbResults" MaxHeight="300" HorizontalContentAlignment="Stretch" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource BaseListboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard">
|
||||
<ListBox x:Name="lbResults" MaxHeight="{Binding ElementName=Results, Path=MaxResultsToShow}" HorizontalContentAlignment="Stretch" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource BaseListboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard">
|
||||
<ListBox.Resources>
|
||||
<!--SelectedItem with focus-->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/>
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Plugin;
|
||||
using UserControl = System.Windows.Controls.UserControl;
|
||||
|
||||
namespace Wox
|
||||
{
|
||||
@@ -31,6 +27,8 @@ namespace Wox
|
||||
|
||||
public bool Dirty { get; set; }
|
||||
|
||||
public int MaxResultsToShow { get { return UserSettingStorage.Instance.MaxResultsToShow * 50; } }
|
||||
|
||||
public void AddResults(List<Result> results)
|
||||
{
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
xmlns:woxPlugin="clr-namespace:Wox.Plugin;assembly=Wox.Plugin"
|
||||
xmlns:system="clr-namespace:Wox.Plugin.SystemPlugins;assembly=Wox.Plugin.SystemPlugins"
|
||||
xmlns:converters="clr-namespace:Wox.Converters"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
Icon="Images\app.png"
|
||||
Title="Wox Settings"
|
||||
ResizeMode="NoResize"
|
||||
@@ -31,6 +32,10 @@
|
||||
<CheckBox x:Name="cbDontPromptUpdateMsg" Margin="10">
|
||||
Don't show upgrade msg if new version available
|
||||
</CheckBox>
|
||||
<StackPanel Orientation="Horizontal" Margin="10">
|
||||
<ComboBox Name="comboMaxResultsToShow"/>
|
||||
<Label>Maximum number of results to show at a time</Label>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Plugin">
|
||||
|
||||
@@ -66,10 +66,21 @@ namespace Wox
|
||||
UserSettingStorage.Instance.Save();
|
||||
};
|
||||
|
||||
comboMaxResultsToShow.SelectionChanged += (o, e) =>
|
||||
{
|
||||
UserSettingStorage.Instance.MaxResultsToShow = (int)comboMaxResultsToShow.SelectedItem;
|
||||
UserSettingStorage.Instance.Save();
|
||||
MainWindow.pnlResult.lbResults.GetBindingExpression(MaxHeightProperty).UpdateTarget();
|
||||
};
|
||||
|
||||
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
||||
cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
|
||||
cbDontPromptUpdateMsg.IsChecked = UserSettingStorage.Instance.DontPromptUpdateMsg;
|
||||
|
||||
comboMaxResultsToShow.ItemsSource = Enumerable.Range(2, 16);
|
||||
var maxResults = UserSettingStorage.Instance.MaxResultsToShow;
|
||||
comboMaxResultsToShow.SelectedItem = maxResults == 0 ? 6 : maxResults;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Theme
|
||||
|
||||
Reference in New Issue
Block a user