mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[Settings] New Settings controls, XAML formatting and cleanup (#21317)
* Awake * Always On Top * ColorPicker * FancyZones * FancyZones * Hosts file editor * ImageResizer * Update ImageResizerPage.xaml * KBM * General * Update MeasureToolPage.xaml * Mouse utils * PowerAccent * Run * PowerOCR * File preview * PowerRename * Shortcut Guide * VCM * XAML styler * Update ShellPage.xaml * XAML formatting and cleanup * Moving converters * Update App.xaml * XAML formatting * XAML formatting * Fixes * XAML formatting * Image resizer updates * Color picker page and margin tweaks * Update PowerLauncherPage.xaml * Tweaks based on Jay's feedback * Resolve conflicts * Add labs source to unit tests * Fix feedback * Fix KBM bug * Infobar fix * Fixes * Resolve conflicts * Add converter
This commit is contained in:
@@ -2,201 +2,219 @@
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.KeyboardManagerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
xmlns:Lib="using:Microsoft.PowerToys.Settings.UI.Library"
|
||||
mc:Ignorable="d"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
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:labs="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI.UI"
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:BoolNegationConverter x:Key="BoolNegationConverter"/>
|
||||
<converters:VisibleIfNotEmptyConverter x:Key="visibleIfNotEmptyConverter" />
|
||||
|
||||
<local:VisibleIfNotEmpty x:Key="visibleIfNotEmptyConverter" />
|
||||
|
||||
<Style TargetType="ListViewItem" x:Name="KeysListViewContainerStyle">
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
<Style
|
||||
x:Name="KeysListViewContainerStyle"
|
||||
TargetType="ListViewItem">
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
</Style>
|
||||
|
||||
|
||||
<DataTemplate x:Key="OriginalKeyTemplate" x:DataType="x:String">
|
||||
<controls:KeyVisual Content="{Binding}" VisualType="SmallOutline" />
|
||||
<DataTemplate
|
||||
x:Key="OriginalKeyTemplate"
|
||||
x:DataType="x:String">
|
||||
<controls:KeyVisual
|
||||
Content="{Binding}"
|
||||
VisualType="SmallOutline" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="RemappedKeyTemplate" x:DataType="x:String">
|
||||
<controls:KeyVisual Content="{Binding}" VisualType="Small" />
|
||||
<DataTemplate
|
||||
x:Key="RemappedKeyTemplate"
|
||||
x:DataType="x:String">
|
||||
<controls:KeyVisual
|
||||
Content="{Binding}"
|
||||
VisualType="Small" />
|
||||
</DataTemplate>
|
||||
|
||||
<!--<DataTemplate x:Name="KeysListViewTemplate" x:DataType="Lib:KeysDataModel">
|
||||
<StackPanel
|
||||
Name="KeyboardManager_RemappedKeysListItem"
|
||||
<StackPanel
|
||||
Name="KeyboardManager_RemappedKeysListItem"
|
||||
x:Uid="KeyboardManager_RemappedKeysListItem"
|
||||
Orientation="Horizontal"
|
||||
Height="56">
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</DataTemplate>-->
|
||||
<!--<DataTemplate x:Name="ShortcutKeysListViewTemplate" x:DataType="Lib:AppSpecificKeysDataModel">
|
||||
<StackPanel
|
||||
Name="KeyboardManager_RemappedShortcutsListItem"
|
||||
<StackPanel
|
||||
Name="KeyboardManager_RemappedShortcutsListItem"
|
||||
x:Uid="KeyboardManager_RemappedShortcutsListItem"
|
||||
Orientation="Horizontal"
|
||||
Height="56">
|
||||
|
||||
|
||||
</DataTemplate>-->
|
||||
</Page.Resources>
|
||||
|
||||
<controls:SettingsPageControl x:Uid="KeyboardManager"
|
||||
ModuleImageSource="ms-appx:///Assets/Modules/KBM.png">
|
||||
<controls:SettingsPageControl
|
||||
x:Uid="KeyboardManager"
|
||||
ModuleImageSource="ms-appx:///Assets/Modules/KBM.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<controls:Setting x:Uid="KeyboardManager_EnableToggle" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
|
||||
<controls:Setting.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsKeyboardManager.png" ShowAsMonochrome="False" />
|
||||
</controls:Setting.Icon>
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Path=ViewModel.Enabled, Mode=TwoWay}" x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
<controls:Setting.Description>
|
||||
<labs:SettingsCard
|
||||
x:Uid="KeyboardManager_EnableToggle"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsKeyboardManager.png}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{x:Bind ViewModel.Enabled, Mode=TwoWay}" />
|
||||
<labs:SettingsCard.Description>
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powerToysCannotRemapKeys">
|
||||
<TextBlock x:Uid="KBM_KeysCannotBeRemapped" FontWeight="SemiBold" />
|
||||
<TextBlock
|
||||
x:Uid="KBM_KeysCannotBeRemapped"
|
||||
FontWeight="SemiBold" />
|
||||
</HyperlinkButton>
|
||||
</controls:Setting.Description>
|
||||
</controls:Setting>
|
||||
|
||||
<InfoBar x:Uid="GPO_IsSettingForced"
|
||||
Severity="Informational"
|
||||
</labs:SettingsCard.Description>
|
||||
</labs:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_IsSettingForced"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" />
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}"
|
||||
Severity="Informational" />
|
||||
|
||||
<controls:SettingsGroup x:Uid="KeyboardManager_Keys" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.Enabled}">
|
||||
<controls:SettingsGroup
|
||||
x:Uid="KeyboardManager_Keys"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.Enabled}">
|
||||
<labs:SettingsCard
|
||||
x:Uid="KeyboardManager_RemapKeyboardButton"
|
||||
ActionIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
|
||||
FontSize=14,
|
||||
Glyph=}"
|
||||
Command="{Binding Path=RemapKeyboardCommand}"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
|
||||
Glyph=}"
|
||||
IsClickEnabled="True" />
|
||||
|
||||
<Button x:Uid="KeyboardManager_RemapKeyboardButton_Accessible" Style="{StaticResource SettingButtonStyle}" Command="{Binding Path=RemapKeyboardCommand}">
|
||||
<controls:Setting x:Uid="KeyboardManager_RemapKeyboardButton" Style="{StaticResource ExpanderHeaderSettingStyle}" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<FontIcon Glyph="" FontSize="18" FontFamily="{ThemeResource SymbolThemeFontFamily}" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</Button>
|
||||
|
||||
<ListView x:Name="RemapKeysList"
|
||||
x:Uid="RemapKeysList"
|
||||
ItemsSource="{x:Bind Path=ViewModel.RemapKeys, Mode=OneWay}"
|
||||
SelectionMode="None"
|
||||
IsSwipeEnabled="False"
|
||||
Visibility="{x:Bind Path=ViewModel.RemapKeys, Mode=OneWay, Converter={StaticResource visibleIfNotEmptyConverter}}">
|
||||
<ListView
|
||||
x:Name="RemapKeysList"
|
||||
x:Uid="RemapKeysList"
|
||||
IsSwipeEnabled="False"
|
||||
ItemsSource="{x:Bind Path=ViewModel.RemapKeys, Mode=OneWay}"
|
||||
SelectionMode="None"
|
||||
Visibility="{x:Bind Path=ViewModel.RemapKeys, Mode=OneWay, Converter={StaticResource visibleIfNotEmptyConverter}}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:DataType="Lib:KeysDataModel">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{ThemeResource CardBackgroundBrush}"
|
||||
BorderThickness="{ThemeResource CardBorderThickness}"
|
||||
BorderBrush="{ThemeResource CardBorderBrush}"
|
||||
CornerRadius="{ThemeResource ControlCornerRadius}"
|
||||
MinHeight="68">
|
||||
|
||||
<ItemsControl Margin="52,0,0,0"
|
||||
ItemsSource="{x:Bind GetMappedOriginalKeys()}"
|
||||
ItemTemplate="{StaticResource OriginalKeyTemplate}"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
<TextBlock x:Uid="To"
|
||||
Style="{StaticResource SecondaryTextStyle}"
|
||||
VerticalAlignment="Center"
|
||||
Margin="8,0,8,0"/>
|
||||
|
||||
<ItemsControl Name="KeyboardManager_RemappedTo"
|
||||
x:Uid="KeyboardManager_RemappedTo"
|
||||
ItemsSource="{x:Bind GetMappedNewRemapKeys()}"
|
||||
ItemTemplate="{StaticResource RemappedKeyTemplate}"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
<labs:SettingsCard ContentAlignment="Left">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ItemsControl
|
||||
IsTabStop="False"
|
||||
ItemTemplate="{StaticResource OriginalKeyTemplate}"
|
||||
ItemsSource="{x:Bind GetMappedOriginalKeys()}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
<controls:IsEnabledTextBlock
|
||||
x:Uid="To"
|
||||
Margin="8,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SecondaryIsEnabledTextBlockStyle}" />
|
||||
<ItemsControl
|
||||
Name="KeyboardManager_RemappedTo"
|
||||
x:Uid="KeyboardManager_RemappedTo"
|
||||
IsTabStop="False"
|
||||
ItemTemplate="{StaticResource RemappedKeyTemplate}"
|
||||
ItemsSource="{x:Bind GetMappedNewRemapKeys()}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</labs:SettingsCard>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup
|
||||
x:Uid="KeyboardManager_Shortcuts"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.Enabled}">
|
||||
<labs:SettingsCard
|
||||
x:Uid="KeyboardManager_RemapShortcutsButton"
|
||||
ActionIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
|
||||
FontSize=14,
|
||||
Glyph=}"
|
||||
Command="{Binding Path=EditShortcutCommand}"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
|
||||
Glyph=}"
|
||||
IsClickEnabled="True" />
|
||||
|
||||
<controls:SettingsGroup x:Uid="KeyboardManager_Shortcuts" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.Enabled}">
|
||||
<Button x:Uid="KeyboardManager_RemapShortcutsButton_Accessible" Style="{StaticResource SettingButtonStyle}" Command="{Binding Path=EditShortcutCommand}">
|
||||
<controls:Setting x:Uid="KeyboardManager_RemapShortcutsButton" Style="{StaticResource ExpanderHeaderSettingStyle}" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<FontIcon Glyph="" FontSize="18" FontFamily="{ThemeResource SymbolThemeFontFamily}" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</Button>
|
||||
|
||||
<ListView x:Name="RemapShortcutsList"
|
||||
x:Uid="RemapShortcutsList"
|
||||
ItemsSource="{x:Bind Path=ViewModel.RemapShortcuts, Mode=OneWay}"
|
||||
SelectionMode="None"
|
||||
IsSwipeEnabled="False"
|
||||
Visibility="{x:Bind Path=ViewModel.RemapShortcuts, Mode=OneWay, Converter={StaticResource visibleIfNotEmptyConverter}}">
|
||||
<ListView
|
||||
x:Name="RemapShortcutsList"
|
||||
x:Uid="RemapShortcutsList"
|
||||
IsSwipeEnabled="False"
|
||||
ItemsSource="{x:Bind Path=ViewModel.RemapShortcuts, Mode=OneWay}"
|
||||
SelectionMode="None"
|
||||
Visibility="{x:Bind Path=ViewModel.RemapShortcuts, Mode=OneWay, Converter={StaticResource visibleIfNotEmptyConverter}}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:DataType="Lib:AppSpecificKeysDataModel">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{ThemeResource CardBackgroundBrush}"
|
||||
BorderThickness="{ThemeResource CardBorderThickness}"
|
||||
BorderBrush="{ThemeResource CardBorderBrush}"
|
||||
CornerRadius="{ThemeResource ControlCornerRadius}"
|
||||
MinHeight="68">
|
||||
|
||||
<ItemsControl Margin="52,0,0,0"
|
||||
ItemsSource="{x:Bind GetMappedOriginalKeys()}"
|
||||
ItemTemplate="{StaticResource OriginalKeyTemplate}"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
<TextBlock x:Uid="To"
|
||||
Style="{StaticResource SecondaryTextStyle}"
|
||||
VerticalAlignment="Center"
|
||||
Margin="8,0,8,0"/>
|
||||
|
||||
<ItemsControl Name="KeyboardManager_RemappedTo"
|
||||
x:Uid="KeyboardManager_RemappedTo"
|
||||
ItemsSource="{x:Bind GetMappedNewRemapKeys()}"
|
||||
ItemTemplate="{StaticResource RemappedKeyTemplate}"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
|
||||
<labs:SettingsCard ContentAlignment="Left">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border VerticalAlignment="Center"
|
||||
Padding="12,4,12,6"
|
||||
Margin="16,0,0,0"
|
||||
CornerRadius="12">
|
||||
<ItemsControl
|
||||
IsTabStop="False"
|
||||
ItemTemplate="{StaticResource OriginalKeyTemplate}"
|
||||
ItemsSource="{x:Bind GetMappedOriginalKeys()}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
<controls:IsEnabledTextBlock
|
||||
x:Uid="To"
|
||||
Margin="8,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SecondaryIsEnabledTextBlockStyle}" />
|
||||
|
||||
<ItemsControl
|
||||
Name="KeyboardManager_RemappedTo"
|
||||
x:Uid="KeyboardManager_RemappedTo"
|
||||
IsTabStop="False"
|
||||
ItemTemplate="{StaticResource RemappedKeyTemplate}"
|
||||
ItemsSource="{x:Bind GetMappedNewRemapKeys()}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
<Border
|
||||
Margin="16,0,0,0"
|
||||
Padding="12,4,12,6"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="12">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{ThemeResource SystemAccentColor}"
|
||||
Opacity="0.3"/>
|
||||
<SolidColorBrush
|
||||
Opacity="0.3"
|
||||
Color="{ThemeResource SystemAccentColor}" />
|
||||
</Border.Background>
|
||||
<TextBlock Text="{x:Bind TargetApp}"/>
|
||||
<TextBlock Text="{x:Bind TargetApp}" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</labs:SettingsCard>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
@@ -204,7 +222,9 @@
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
<controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:PageLink x:Uid="LearnMore_KBM" Link="https://aka.ms/PowerToysOverview_KeyboardManager"/>
|
||||
<controls:PageLink
|
||||
x:Uid="LearnMore_KBM"
|
||||
Link="https://aka.ms/PowerToysOverview_KeyboardManager" />
|
||||
</controls:SettingsPageControl.PrimaryLinks>
|
||||
</controls:SettingsPageControl>
|
||||
</Page>
|
||||
|
||||
Reference in New Issue
Block a user