mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[PTRun][Shell]Shell selection and combobox improvements (#28972)
* Make combobox items sortable * Update plugin settings * settings description * fix settings hang on outdated plugin code * spell fixes, shell implementation, translation improvements * rename property * backward compatibility * comment changes * comment changes * review feedback 1 * review feedback 2 * Code clean up
This commit is contained in:
@@ -153,12 +153,8 @@
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" />
|
||||
</controls:SettingsCard>
|
||||
|
||||
<controls:SettingsCard
|
||||
x:Uid="PowerLauncher_UsePinyin"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" />
|
||||
<controls:SettingsCard x:Uid="PowerLauncher_UsePinyin" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" />
|
||||
</controls:SettingsCard>
|
||||
|
||||
<controls:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles">
|
||||
@@ -388,8 +384,10 @@
|
||||
Visibility="{x:Bind Path=ShowComboBox, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
ItemsSource="{x:Bind Path=ComboBoxOptions}"
|
||||
SelectedIndex="{x:Bind Path=ComboBoxValue, Mode=TwoWay}" />
|
||||
DisplayMemberPath="Key"
|
||||
ItemsSource="{x:Bind Path=ComboBoxItems}"
|
||||
SelectedValue="{x:Bind Path=ComboBoxValue, Mode=TwoWay}"
|
||||
SelectedValuePath="Value" />
|
||||
</controls:SettingsCard>
|
||||
<!-- TextBox setting -->
|
||||
<controls:SettingsCard
|
||||
@@ -456,8 +454,10 @@
|
||||
IsEnabled="{x:Bind Path=SecondSettingIsEnabled, Mode=OneWay}">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
ItemsSource="{x:Bind Path=ComboBoxOptions}"
|
||||
SelectedIndex="{x:Bind Path=ComboBoxValue, Mode=TwoWay}" />
|
||||
DisplayMemberPath="Key"
|
||||
ItemsSource="{x:Bind Path=ComboBoxItems}"
|
||||
SelectedValue="{x:Bind Path=ComboBoxValue, Mode=TwoWay}"
|
||||
SelectedValuePath="Value" />
|
||||
</controls:SettingsCard>
|
||||
</StackPanel>
|
||||
<!-- Checkbox And TextBox setting -->
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
|
||||
@@ -47,18 +48,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
// ComboBox setting
|
||||
public bool ShowComboBox => _additionalOption.PluginOptionType == PluginAdditionalOption.AdditionalOptionType.Combobox &&
|
||||
_additionalOption.ComboBoxOptions != null && _additionalOption.ComboBoxOptions.Count > 0;
|
||||
_additionalOption.ComboBoxItems != null && _additionalOption.ComboBoxItems.Count > 0;
|
||||
|
||||
public List<string> ComboBoxOptions => _additionalOption.ComboBoxOptions;
|
||||
public List<KeyValuePair<string, string>> ComboBoxItems => _additionalOption.ComboBoxItems;
|
||||
|
||||
public int ComboBoxValue
|
||||
public string ComboBoxValue
|
||||
{
|
||||
get => _additionalOption.ComboBoxValue;
|
||||
get => _additionalOption.ComboBoxValue.ToString(CultureInfo.InvariantCulture);
|
||||
set
|
||||
{
|
||||
if (value != _additionalOption.ComboBoxValue)
|
||||
if (int.Parse(value, CultureInfo.InvariantCulture) != _additionalOption.ComboBoxValue)
|
||||
{
|
||||
_additionalOption.ComboBoxValue = value;
|
||||
_additionalOption.ComboBoxValue = int.Parse(value, CultureInfo.InvariantCulture);
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user