mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Settings][PTRun]Improve XAML and settings page loading (#32643)
* Improve Run settings page performance * Use ItemTemplateSelector for plugin options * Use ItemsRepeater for plugins list * fix xaml formatting
This commit is contained in:
committed by
GitHub
parent
b0e59d66b5
commit
9699feea40
@@ -0,0 +1,60 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Library;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||||
|
{
|
||||||
|
public sealed class RunOptionTemplateSelector : DataTemplateSelector
|
||||||
|
{
|
||||||
|
public DataTemplate CheckBoxTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate ComboBoxTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate TextboxTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate NumberBoxTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate MultilineTextBoxTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate CheckBoxComboBoxTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate CheckBoxTextBoxTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate CheckBoxMultilineTextBoxTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate CheckBoxNumberBoxTemplate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an empty template used as fall back in case of malformed data
|
||||||
|
/// </summary>
|
||||||
|
public DataTemplate EmptyTemplate { get; set; }
|
||||||
|
|
||||||
|
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
|
||||||
|
{
|
||||||
|
if (item is PluginAdditionalOptionViewModel optionViewModel)
|
||||||
|
{
|
||||||
|
return optionViewModel.Type switch
|
||||||
|
{
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.Checkbox => CheckBoxTemplate,
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.Combobox => ComboBoxTemplate,
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.Textbox => TextboxTemplate,
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.Numberbox => NumberBoxTemplate,
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.MultilineTextbox => MultilineTextBoxTemplate,
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.CheckboxAndCombobox => CheckBoxComboBoxTemplate,
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.CheckboxAndTextbox => CheckBoxTextBoxTemplate,
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.CheckboxAndNumberbox => CheckBoxNumberBoxTemplate,
|
||||||
|
PluginAdditionalOption.AdditionalOptionType.CheckboxAndMultilineTextbox => CheckBoxMultilineTextBoxTemplate,
|
||||||
|
_ => EmptyTemplate,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ArgumentException("Item must be an PluginAdditionalOptionViewModel", nameof(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:ViewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
xmlns:ViewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||||
|
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:i="using:Microsoft.Xaml.Interactivity"
|
xmlns:i="using:Microsoft.Xaml.Interactivity"
|
||||||
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
|
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
|
||||||
@@ -13,6 +14,293 @@
|
|||||||
AutomationProperties.LandmarkType="Main"
|
AutomationProperties.LandmarkType="Main"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Page.Resources>
|
||||||
|
<Style x:Key="OptionSeparator" TargetType="Rectangle">
|
||||||
|
<Setter Property="Height" Value="1" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="Fill" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<converters:RunOptionTemplateSelector
|
||||||
|
x:Key="RunOptionTemplateSelector"
|
||||||
|
CheckBoxComboBoxTemplate="{StaticResource CheckBoxComboBoxTemplate}"
|
||||||
|
CheckBoxMultilineTextBoxTemplate="{StaticResource CheckBoxMultilineTextBoxTemplate}"
|
||||||
|
CheckBoxNumberBoxTemplate="{StaticResource CheckBoxNumberBoxTemplate}"
|
||||||
|
CheckBoxTemplate="{StaticResource CheckBoxTemplate}"
|
||||||
|
CheckBoxTextBoxTemplate="{StaticResource CheckBoxTextBoxTemplate}"
|
||||||
|
ComboBoxTemplate="{StaticResource ComboBoxTemplate}"
|
||||||
|
EmptyTemplate="{StaticResource EmptyTemplate}"
|
||||||
|
MultilineTextBoxTemplate="{StaticResource MultilineTextBoxTemplate}"
|
||||||
|
NumberBoxTemplate="{StaticResource NumberBoxTemplate}"
|
||||||
|
TextboxTemplate="{StaticResource TextBoxTemplate}" />
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CheckBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="1"
|
||||||
|
Padding="0,6,0,12"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
ContentAlignment="Left"
|
||||||
|
CornerRadius="0">
|
||||||
|
<controls:CheckBoxWithDescriptionControl
|
||||||
|
Margin="56,0,0,0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}"
|
||||||
|
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ComboBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="56,8,45,8"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
CornerRadius="0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}">
|
||||||
|
<ComboBox
|
||||||
|
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
DisplayMemberPath="Key"
|
||||||
|
ItemsSource="{x:Bind Path=ComboBoxItems}"
|
||||||
|
SelectedValue="{x:Bind ComboBoxValue, Mode=TwoWay}"
|
||||||
|
SelectedValuePath="Value" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="TextBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="56,8,45,8"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
CornerRadius="0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}">
|
||||||
|
<TextBox
|
||||||
|
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
MaxWidth="450"
|
||||||
|
MaxLength="{x:Bind TextBoxMaxLength, Mode=OneWay}"
|
||||||
|
PlaceholderText="{x:Bind Path=PlaceholderText}"
|
||||||
|
Text="{x:Bind TextValue, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="NumberBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="56,8,45,8"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
CornerRadius="0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}">
|
||||||
|
<NumberBox
|
||||||
|
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
LargeChange="{x:Bind NumberBoxLargeChange, Mode=OneWay}"
|
||||||
|
Maximum="{x:Bind NumberBoxMax, Mode=OneWay}"
|
||||||
|
Minimum="{x:Bind NumberBoxMin, Mode=OneWay}"
|
||||||
|
SmallChange="{x:Bind NumberBoxSmallChange, Mode=OneWay}"
|
||||||
|
SpinButtonPlacementMode="Compact"
|
||||||
|
Value="{x:Bind NumberValue, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="MultilineTextBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="56,8,45,8"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
ContentAlignment="Vertical"
|
||||||
|
CornerRadius="0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}">
|
||||||
|
<TextBox
|
||||||
|
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
MinHeight="160"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
PlaceholderText="{x:Bind Path=PlaceholderText}"
|
||||||
|
ScrollViewer.IsVerticalRailEnabled="True"
|
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||||
|
ScrollViewer.VerticalScrollMode="Enabled"
|
||||||
|
Text="{x:Bind TextValue, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CheckBoxComboBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="1"
|
||||||
|
Padding="0,6,0,4"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
ContentAlignment="Left"
|
||||||
|
CornerRadius="0">
|
||||||
|
<controls:CheckBoxWithDescriptionControl
|
||||||
|
Margin="56,0,0,0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}"
|
||||||
|
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="84,0,45,8"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
CornerRadius="0"
|
||||||
|
Description="{x:Bind Path=SecondDisplayDescription}"
|
||||||
|
Header="{x:Bind Path=SecondDisplayLabel}"
|
||||||
|
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
||||||
|
<ComboBox
|
||||||
|
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
DisplayMemberPath="Key"
|
||||||
|
ItemsSource="{x:Bind Path=ComboBoxItems}"
|
||||||
|
SelectedValue="{x:Bind ComboBoxValue, Mode=TwoWay}"
|
||||||
|
SelectedValuePath="Value" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CheckBoxTextBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="1"
|
||||||
|
Padding="0,6,0,4"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
ContentAlignment="Left"
|
||||||
|
CornerRadius="0">
|
||||||
|
<controls:CheckBoxWithDescriptionControl
|
||||||
|
Margin="56,0,0,0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}"
|
||||||
|
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="84,0,45,8"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
CornerRadius="0"
|
||||||
|
Description="{x:Bind Path=SecondDisplayDescription}"
|
||||||
|
Header="{x:Bind Path=SecondDisplayLabel}"
|
||||||
|
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
||||||
|
<TextBox
|
||||||
|
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
MaxWidth="450"
|
||||||
|
MaxLength="{x:Bind TextBoxMaxLength, Mode=OneWay}"
|
||||||
|
PlaceholderText="{x:Bind Path=PlaceholderText}"
|
||||||
|
Text="{x:Bind TextValue, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CheckBoxMultilineTextBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="1"
|
||||||
|
Padding="0,6,0,4"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
ContentAlignment="Left"
|
||||||
|
CornerRadius="0">
|
||||||
|
<controls:CheckBoxWithDescriptionControl
|
||||||
|
Margin="56,0,0,0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}"
|
||||||
|
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="84,0,45,8"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
ContentAlignment="Vertical"
|
||||||
|
CornerRadius="0"
|
||||||
|
Description="{x:Bind Path=SecondDisplayDescription}"
|
||||||
|
Header="{x:Bind Path=SecondDisplayLabel}"
|
||||||
|
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
||||||
|
<TextBox
|
||||||
|
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
MinHeight="160"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
PlaceholderText="{x:Bind Path=PlaceholderText}"
|
||||||
|
ScrollViewer.IsVerticalRailEnabled="True"
|
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||||
|
ScrollViewer.VerticalScrollMode="Enabled"
|
||||||
|
Text="{x:Bind TextValue, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CheckBoxNumberBoxTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="1"
|
||||||
|
Padding="0,6,0,4"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
ContentAlignment="Left"
|
||||||
|
CornerRadius="0">
|
||||||
|
<controls:CheckBoxWithDescriptionControl
|
||||||
|
Margin="56,0,0,0"
|
||||||
|
Description="{x:Bind Path=DisplayDescription}"
|
||||||
|
Header="{x:Bind Path=DisplayLabel}"
|
||||||
|
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinHeight="0"
|
||||||
|
Margin="84,0,45,8"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0,0,0,0"
|
||||||
|
CornerRadius="0"
|
||||||
|
Description="{x:Bind Path=SecondDisplayDescription}"
|
||||||
|
Header="{x:Bind Path=SecondDisplayLabel}"
|
||||||
|
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
||||||
|
<NumberBox
|
||||||
|
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
LargeChange="{x:Bind NumberBoxLargeChange, Mode=OneWay}"
|
||||||
|
Maximum="{x:Bind NumberBoxMax, Mode=OneWay}"
|
||||||
|
Minimum="{x:Bind NumberBoxMin, Mode=OneWay}"
|
||||||
|
SmallChange="{x:Bind NumberBoxSmallChange, Mode=OneWay}"
|
||||||
|
SpinButtonPlacementMode="Compact"
|
||||||
|
Value="{x:Bind NumberValue, Mode=TwoWay}" />
|
||||||
|
</tkcontrols:SettingsCard>
|
||||||
|
<Rectangle Style="{StaticResource OptionSeparator}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="EmptyTemplate" x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" />
|
||||||
|
</DataTemplate>
|
||||||
|
</Page.Resources>
|
||||||
|
|
||||||
<controls:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/Run.png">
|
<controls:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/Run.png">
|
||||||
<controls:SettingsPageControl.ModuleContent>
|
<controls:SettingsPageControl.ModuleContent>
|
||||||
|
|
||||||
@@ -297,13 +585,11 @@
|
|||||||
Style="{ThemeResource SecondaryTextStyle}" />
|
Style="{ThemeResource SecondaryTextStyle}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<ItemsControl x:Name="PluginsListView" ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}">
|
<ItemsRepeater x:Name="PluginsListView" ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsRepeater.Layout>
|
||||||
<ItemsPanelTemplate>
|
<StackLayout Spacing="2" />
|
||||||
<StackPanel Spacing="2" />
|
</ItemsRepeater.Layout>
|
||||||
</ItemsPanelTemplate>
|
<ItemsRepeater.ItemTemplate>
|
||||||
</ItemsControl.ItemsPanel>
|
|
||||||
<ItemsControl.ItemTemplate>
|
|
||||||
<DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay">
|
<DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay">
|
||||||
<Grid>
|
<Grid>
|
||||||
<tkcontrols:SettingsExpander Description="{x:Bind Description}" Header="{x:Bind Path=Name}">
|
<tkcontrols:SettingsExpander Description="{x:Bind Description}" Header="{x:Bind Path=Name}">
|
||||||
@@ -395,261 +681,8 @@
|
|||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
IsEnabled="{x:Bind Enabled, Mode=OneWay}"
|
IsEnabled="{x:Bind Enabled, Mode=OneWay}"
|
||||||
ItemsSource="{x:Bind Path=AdditionalOptions}">
|
ItemTemplateSelector="{StaticResource RunOptionTemplateSelector}"
|
||||||
<ItemsControl.ItemTemplate>
|
ItemsSource="{x:Bind Path=AdditionalOptions}" />
|
||||||
<DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel">
|
|
||||||
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
|
||||||
<!-- Checkbox setting -->
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="1"
|
|
||||||
Padding="0,6,0,12"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
ContentAlignment="Left"
|
|
||||||
CornerRadius="0"
|
|
||||||
Visibility="{x:Bind Path=ShowCheckBox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<controls:CheckBoxWithDescriptionControl
|
|
||||||
Margin="56,0,0,0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<!-- ComboBox setting -->
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="56,8,45,8"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
CornerRadius="0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
Visibility="{x:Bind Path=ShowComboBox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<ComboBox
|
|
||||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
|
||||||
DisplayMemberPath="Key"
|
|
||||||
ItemsSource="{x:Bind Path=ComboBoxItems}"
|
|
||||||
SelectedValue="{x:Bind ComboBoxValue, Mode=TwoWay}"
|
|
||||||
SelectedValuePath="Value" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<!-- TextBox setting -->
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="56,8,45,8"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
CornerRadius="0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
Visibility="{x:Bind Path=ShowTextBox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<TextBox
|
|
||||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
|
||||||
MaxWidth="450"
|
|
||||||
MaxLength="{x:Bind TextBoxMaxLength, Mode=OneWay}"
|
|
||||||
PlaceholderText="{x:Bind Path=PlaceholderText}"
|
|
||||||
Text="{x:Bind TextValue, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<!-- MultilineTextBox setting -->
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="56,8,45,8"
|
|
||||||
HorizontalContentAlignment="Stretch"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
ContentAlignment="Vertical"
|
|
||||||
CornerRadius="0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
Visibility="{x:Bind Path=ShowMultilineTextBox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<TextBox
|
|
||||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
|
||||||
MinHeight="160"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
PlaceholderText="{x:Bind Path=PlaceholderText}"
|
|
||||||
ScrollViewer.IsVerticalRailEnabled="True"
|
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
|
||||||
ScrollViewer.VerticalScrollMode="Enabled"
|
|
||||||
Text="{x:Bind TextValue, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<!-- NumberBox setting -->
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="56,8,45,8"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
CornerRadius="0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
Visibility="{x:Bind Path=ShowNumberBox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<NumberBox
|
|
||||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
|
||||||
LargeChange="{x:Bind NumberBoxLargeChange, Mode=OneWay}"
|
|
||||||
Maximum="{x:Bind NumberBoxMax, Mode=OneWay}"
|
|
||||||
Minimum="{x:Bind NumberBoxMin, Mode=OneWay}"
|
|
||||||
SmallChange="{x:Bind NumberBoxSmallChange, Mode=OneWay}"
|
|
||||||
SpinButtonPlacementMode="Compact"
|
|
||||||
Value="{x:Bind NumberValue, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<!-- Checkbox And ComboBox setting -->
|
|
||||||
<StackPanel
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Orientation="Vertical"
|
|
||||||
Visibility="{x:Bind Path=ShowCheckboxAndCombobox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="1"
|
|
||||||
Padding="0,6,0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
ContentAlignment="Left"
|
|
||||||
CornerRadius="0">
|
|
||||||
<controls:CheckBoxWithDescriptionControl
|
|
||||||
Margin="56,0,0,0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="84,0,45,8"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
CornerRadius="0"
|
|
||||||
Description="{x:Bind Path=SecondDisplayDescription}"
|
|
||||||
Header="{x:Bind Path=SecondDisplayLabel}"
|
|
||||||
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
|
||||||
<ComboBox
|
|
||||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
|
||||||
DisplayMemberPath="Key"
|
|
||||||
ItemsSource="{x:Bind Path=ComboBoxItems}"
|
|
||||||
SelectedValue="{x:Bind ComboBoxValue, Mode=TwoWay}"
|
|
||||||
SelectedValuePath="Value" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
</StackPanel>
|
|
||||||
<!-- Checkbox And TextBox setting -->
|
|
||||||
<StackPanel
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Orientation="Vertical"
|
|
||||||
Visibility="{x:Bind Path=ShowCheckboxAndTextbox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="1"
|
|
||||||
Padding="0,6,0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
ContentAlignment="Left"
|
|
||||||
CornerRadius="0">
|
|
||||||
<controls:CheckBoxWithDescriptionControl
|
|
||||||
Margin="56,0,0,0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="84,0,45,8"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
CornerRadius="0"
|
|
||||||
Description="{x:Bind Path=SecondDisplayDescription}"
|
|
||||||
Header="{x:Bind Path=SecondDisplayLabel}"
|
|
||||||
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
|
||||||
<TextBox
|
|
||||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
|
||||||
MaxWidth="450"
|
|
||||||
MaxLength="{x:Bind TextBoxMaxLength, Mode=OneWay}"
|
|
||||||
PlaceholderText="{x:Bind Path=PlaceholderText}"
|
|
||||||
Text="{x:Bind TextValue, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
</StackPanel>
|
|
||||||
<!-- Checkbox And MultilineTextBox setting -->
|
|
||||||
<StackPanel
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Orientation="Vertical"
|
|
||||||
Visibility="{x:Bind Path=ShowCheckboxAndMultilineTextbox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="1"
|
|
||||||
Padding="0,6,0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
ContentAlignment="Left"
|
|
||||||
CornerRadius="0">
|
|
||||||
<controls:CheckBoxWithDescriptionControl
|
|
||||||
Margin="56,0,0,0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="84,0,45,8"
|
|
||||||
HorizontalContentAlignment="Stretch"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
ContentAlignment="Vertical"
|
|
||||||
CornerRadius="0"
|
|
||||||
Description="{x:Bind Path=SecondDisplayDescription}"
|
|
||||||
Header="{x:Bind Path=SecondDisplayLabel}"
|
|
||||||
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
|
||||||
<TextBox
|
|
||||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
|
||||||
MinHeight="160"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
PlaceholderText="{x:Bind Path=PlaceholderText}"
|
|
||||||
ScrollViewer.IsVerticalRailEnabled="True"
|
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
|
||||||
ScrollViewer.VerticalScrollMode="Enabled"
|
|
||||||
Text="{x:Bind TextValue, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
</StackPanel>
|
|
||||||
<!-- Checkbox And NumberBox setting -->
|
|
||||||
<StackPanel
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Orientation="Vertical"
|
|
||||||
Visibility="{x:Bind Path=ShowCheckboxAndNumberbox, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="1"
|
|
||||||
Padding="0,6,0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
ContentAlignment="Left"
|
|
||||||
CornerRadius="0">
|
|
||||||
<controls:CheckBoxWithDescriptionControl
|
|
||||||
Margin="56,0,0,0"
|
|
||||||
Description="{x:Bind Path=DisplayDescription}"
|
|
||||||
Header="{x:Bind Path=DisplayLabel}"
|
|
||||||
IsChecked="{x:Bind Value, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
<tkcontrols:SettingsCard
|
|
||||||
MinHeight="0"
|
|
||||||
Margin="84,0,45,8"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0,0,0,0"
|
|
||||||
CornerRadius="0"
|
|
||||||
Description="{x:Bind Path=SecondDisplayDescription}"
|
|
||||||
Header="{x:Bind Path=SecondDisplayLabel}"
|
|
||||||
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
|
||||||
<NumberBox
|
|
||||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
|
||||||
LargeChange="{x:Bind NumberBoxLargeChange, Mode=OneWay}"
|
|
||||||
Maximum="{x:Bind NumberBoxMax, Mode=OneWay}"
|
|
||||||
Minimum="{x:Bind NumberBoxMin, Mode=OneWay}"
|
|
||||||
SmallChange="{x:Bind NumberBoxSmallChange, Mode=OneWay}"
|
|
||||||
SpinButtonPlacementMode="Compact"
|
|
||||||
Value="{x:Bind NumberValue, Mode=TwoWay}" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
</StackPanel>
|
|
||||||
<!-- Separator line -->
|
|
||||||
<Rectangle
|
|
||||||
Height="1"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Fill="{ThemeResource CardStrokeColorDefaultBrush}" />
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
|
||||||
</tkcontrols:SettingsCard>
|
</tkcontrols:SettingsCard>
|
||||||
<tkcontrols:SettingsCard
|
<tkcontrols:SettingsCard
|
||||||
MinHeight="0"
|
MinHeight="0"
|
||||||
@@ -664,8 +697,8 @@
|
|||||||
</tkcontrols:SettingsExpander>
|
</tkcontrols:SettingsExpander>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsRepeater.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsRepeater>
|
||||||
</controls:SettingsGroup>
|
</controls:SettingsGroup>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
public string SecondDisplayDescription => _additionalOption.SecondDisplayDescription;
|
public string SecondDisplayDescription => _additionalOption.SecondDisplayDescription;
|
||||||
|
|
||||||
|
public PluginAdditionalOption.AdditionalOptionType Type => _additionalOption.PluginOptionType;
|
||||||
|
|
||||||
// Bool checkbox setting
|
// Bool checkbox setting
|
||||||
public bool ShowCheckBox => _additionalOption.PluginOptionType == PluginAdditionalOption.AdditionalOptionType.Checkbox;
|
public bool ShowCheckBox => _additionalOption.PluginOptionType == PluginAdditionalOption.AdditionalOptionType.Checkbox;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user