[Settings] Shortcut UX redesign (#12977)

* Added dialog

* Added virtualkey logic

* Key logic in place

* Styling

* Updated layout

* Updated foreground

* Refactor

* Catching error handling

* Hotkey UI handling

* Spell check

* Adding shortcut visuals to OOBE

* INtroducing shortcutcontrol for OOBE

* Removed unneccasry comments

* OOBE fixes

* Fix

* Visual updates

* Update Product.wxs

* Updated UI

* Update Product.wxs

* Changes

* Changed installer file

* Fixed warner banner height

* Added visual key to KBR

* Updated margin

* pr 12977: fix installer issue (#13075)

Co-authored-by: Niels Laute <niels9001@hotmail.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
Niels Laute 2021-09-06 20:21:18 +02:00 committed by GitHub
parent 2bfc62d9a5
commit a6cca7cfb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 883 additions and 427 deletions

View File

@ -2113,6 +2113,7 @@ todo
toggleswitch
toolbar
Toolchain
toolkitcontrols
toolkitconverters
toolset
toolstrip

View File

@ -878,10 +878,10 @@
<?endforeach?>
</Component>
</DirectoryRef>
<DirectoryRef Id="SettingsV2ControlsInstallFolder" FileSource="$(var.BinX64Dir)Settings\Controls">
<DirectoryRef Id="SettingsV2ControlsInstallFolder" FileSource="$(var.BinX64Dir)Settings\Controls\ShortcutControl">
<Component Id="SettingsV2Controls" Guid="05C55C88-B59A-4450-A07C-EB7626E0781A" Win64="yes">
<?foreach File in HotkeySettingsControl.xbf?>
<File Id="SettingsV2_Controls_$(var.File)" Source="$(var.BinX64Dir)Settings\Controls\$(var.File)" />
<?foreach File in ShortcutControl.xbf?>
<File Id="SettingsV2_Controls_$(var.File)" Source="$(var.BinX64Dir)Settings\Controls\ShortcutControl\$(var.File)" />
<?endforeach?>
</Component>
</DirectoryRef>

View File

@ -2,6 +2,7 @@
// 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.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
@ -100,6 +101,55 @@ namespace Microsoft.PowerToys.Settings.UI.Library
return output.ToString();
}
public List<object> GetKeysList()
{
List<object> shortcutList = new List<object>();
if (Win)
{
shortcutList.Add(92); // The Windows key or button.
}
if (Ctrl)
{
shortcutList.Add("Ctrl");
}
if (Alt)
{
shortcutList.Add("Alt");
}
if (Shift)
{
shortcutList.Add("Shift");
// shortcutList.Add(16); // The Shift key or button.
}
if (Code > 0)
{
switch (Code)
{
// https://docs.microsoft.com/en-us/uwp/api/windows.system.virtualkey?view=winrt-20348
case 38: // The Up Arrow key or button.
case 40: // The Down Arrow key or button.
case 37: // The Left Arrow key or button.
case 39: // The Right Arrow key or button.
// case 8: // The Back key or button.
// case 13: // The Enter key or button.
shortcutList.Add(Code);
break;
default:
var localKey = Helper.GetKeyName((uint)Code);
shortcutList.Add(localKey);
break;
}
}
return shortcutList;
}
public bool IsValid()
{
if (IsAccessibleShortcut())

View File

@ -1,15 +0,0 @@
<UserControl
x:Class="Microsoft.PowerToys.Settings.UI.Controls.HotkeySettingsControl"
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.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<TextBox x:Name="HotkeyTextBox"
x:Uid="SettingsPage_SetShortcut"
IsReadOnly="True"/>
</UserControl>

View File

@ -2,29 +2,186 @@
// 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.ComponentModel.Design;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Markup;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
[TemplatePart(Name = KeyPresenter, Type = typeof(ContentPresenter))]
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Default", GroupName = "StateStates")]
[TemplateVisualState(Name = "Error", GroupName = "StateStates")]
public sealed class KeyVisual : Control
{
private const string KeyPresenter = "KeyPresenter";
private KeyVisual _keyVisual;
private ContentPresenter _keyPresenter;
public object Content
{
get => (string)GetValue(ContentProperty);
get => (object)GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register("Content", typeof(object), typeof(KeyVisual), new PropertyMetadata(default(string)));
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register("Content", typeof(object), typeof(KeyVisual), new PropertyMetadata(default(string), OnContentChanged));
public VisualType VisualType
{
get => (VisualType)GetValue(VisualTypeProperty);
set => SetValue(VisualTypeProperty, value);
}
public static readonly DependencyProperty VisualTypeProperty = DependencyProperty.Register("VisualType", typeof(VisualType), typeof(KeyVisual), new PropertyMetadata(default(VisualType), OnSizeChanged));
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
}
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register("IsError", typeof(bool), typeof(KeyVisual), new PropertyMetadata(false, OnIsErrorChanged));
public KeyVisual()
{
this.DefaultStyleKey = typeof(KeyVisual);
this.Style = GetStyleSize("TextKeyVisualStyle");
}
protected override void OnApplyTemplate()
{
IsEnabledChanged -= KeyVisual_IsEnabledChanged;
_keyVisual = (KeyVisual)this;
_keyPresenter = (ContentPresenter)_keyVisual.GetTemplateChild(KeyPresenter);
Update();
SetEnabledState();
SetErrorState();
IsEnabledChanged += KeyVisual_IsEnabledChanged;
base.OnApplyTemplate();
}
private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((KeyVisual)d).Update();
}
private static void OnSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((KeyVisual)d).Update();
}
private static void OnIsErrorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((KeyVisual)d).SetErrorState();
}
private void Update()
{
if (_keyVisual == null)
{
return;
}
if (_keyVisual.Content != null)
{
if (_keyVisual.Content.GetType() == typeof(string))
{
_keyVisual.Style = GetStyleSize("TextKeyVisualStyle");
_keyVisual._keyPresenter.Content = _keyVisual.Content;
}
else
{
_keyVisual.Style = GetStyleSize("IconKeyVisualStyle");
switch ((int)_keyVisual.Content)
{
/* We can enable other glyphs in the future
case 13: // The Enter key or button.
_keyVisual._keyPresenter.Content = "\uE751"; break;
case 8: // The Back key or button.
_keyVisual._keyPresenter.Content = "\uE750"; break;
case 16: // The right Shift key or button.
case 160: // The left Shift key or button.
case 161: // The Shift key or button.
_keyVisual._keyPresenter.Content = "\uE752"; break; */
case 38: _keyVisual._keyPresenter.Content = "\uE0E4"; break; // The Up Arrow key or button.
case 40: _keyVisual._keyPresenter.Content = "\uE0E5"; break; // The Down Arrow key or button.
case 37: _keyVisual._keyPresenter.Content = "\uE0E2"; break; // The Left Arrow key or button.
case 39: _keyVisual._keyPresenter.Content = "\uE0E3"; break; // The Right Arrow key or button.
case 91: // The left Windows key
case 92: // The right Windows key
PathIcon winIcon = XamlReader.Load(@"<PathIcon xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" Data=""M9,17V9h8v8ZM0,17V9H8v8ZM9,8V0h8V8ZM0,8V0H8V8Z"" />") as PathIcon;
Viewbox winIconContainer = new Viewbox();
winIconContainer.Child = winIcon;
winIconContainer.HorizontalAlignment = HorizontalAlignment.Center;
winIconContainer.VerticalAlignment = VerticalAlignment.Center;
double iconDimensions = GetIconSize();
winIconContainer.Height = iconDimensions;
winIconContainer.Width = iconDimensions;
_keyVisual._keyPresenter.Content = winIconContainer;
break;
default: _keyVisual._keyPresenter.Content = ((VirtualKey)_keyVisual.Content).ToString(); break;
}
}
}
}
public Style GetStyleSize(string styleName)
{
if (VisualType == VisualType.Small)
{
return (Style)App.Current.Resources["Small" + styleName];
}
else if (VisualType == VisualType.SmallOutline)
{
return (Style)App.Current.Resources["SmallOutline" + styleName];
}
else
{
return (Style)App.Current.Resources["Default" + styleName];
}
}
public double GetIconSize()
{
if (VisualType == VisualType.Small || VisualType == VisualType.SmallOutline)
{
return (double)App.Current.Resources["SmallIconSize"];
}
else
{
return (double)App.Current.Resources["DefaultIconSize"];
}
}
private void KeyVisual_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
SetEnabledState();
}
private void SetErrorState()
{
VisualStateManager.GoToState(this, IsError ? "Error" : "Default", true);
}
private void SetEnabledState()
{
VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true);
}
}
public enum VisualType
{
Small,
SmallOutline,
Large,
}
}

View File

@ -2,56 +2,123 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls">
<!-- This can be removed once we adopt WinUI 2.6 or higher -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<Color x:Key="ControlStrokeColorDefault">#12FFFFFF</Color>
<Color x:Key="ControlStrokeColorSecondary">#18FFFFFF</Color>
<Color x:Key="ControlFillColorDefault">#0FFFFFFF</Color>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<Color x:Key="ControlStrokeColorDefault">#0F000000</Color>
<Color x:Key="ControlStrokeColorSecondary">#29000000</Color>
<Color x:Key="ControlFillColorDefault">#B3FFFFFF</Color>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<LinearGradientBrush x:Key="ControlElevationBorderBrush"
MappingMode="Absolute"
StartPoint="0,0"
EndPoint="0,3">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.33"
Color="{ThemeResource ControlStrokeColorSecondary}" />
<GradientStop Offset="1.0"
Color="{ThemeResource ControlStrokeColorDefault}" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<!--- -->
<Style TargetType="local:KeyVisual">
<x:Double x:Key="DefaultIconSize">16</x:Double>
<x:Double x:Key="SmallIconSize">12</x:Double>
<Style x:Key="DefaultTextKeyVisualStyle" TargetType="local:KeyVisual">
<Setter Property="MinWidth" Value="56" />
<Setter Property="MinHeight" Value="48" />
<Setter Property="Background" Value="{ThemeResource AccentButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource AccentButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource AccentButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
<Setter Property="Padding" Value="16,8,16,8" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:KeyVisual">
<!-- Background="{ThemeResource ControlFillColorDefault}" -->
<Border Background="LightGray"
BorderThickness="1"
BorderBrush="{ThemeResource ControlElevationBorderBrush}"
CornerRadius="4"
Padding="11,5,11,6"
Height="32">
<ContentPresenter Content="{TemplateBinding Content}"
FontWeight="SemiBold"
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<!--<Setter Target="ContentHolder.Fill" Value="{ThemeResource AccentButtonBackgroundDisabled}" />
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource AccentButtonForegroundDisabled}" />
<Setter Target="ContentHolder.Stroke" Value="{ThemeResource AccentButtonBorderBrushDisabled}" />
<Setter Target="ContentHolder.StrokeThickness" Value="{TemplateBinding BorderThickness}" />-->
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="StateStates">
<VisualState x:Name="Default"/>
<VisualState x:Name="Error">
<VisualState.Setters>
<Setter Target="ContentHolder.Fill" Value="{ThemeResource InfoBarErrorSeverityBackgroundBrush}" />
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource InfoBarErrorSeverityIconBackground}" />
<Setter Target="ContentHolder.Stroke" Value="{ThemeResource InfoBarErrorSeverityIconBackground}" />
<Setter Target="ContentHolder.StrokeThickness" Value="2" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Rectangle x:Name="ContentHolder"
Fill="{TemplateBinding Background}"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}"
RadiusX="4"
RadiusY="4"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"/>
<ContentPresenter x:Name="KeyPresenter"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
Content="{TemplateBinding Content}"
Margin="{TemplateBinding Padding}"
FontSize="{TemplateBinding FontSize}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center" />
</Border>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SmallTextKeyVisualStyle" TargetType="local:KeyVisual" BasedOn="{StaticResource DefaultTextKeyVisualStyle}">
<Setter Property="MinWidth" Value="40" />
<Setter Property="Height" Value="36" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Padding" Value="12,0,12,2" />
<Setter Property="FontSize" Value="14" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style x:Key="SmallOutlineTextKeyVisualStyle" TargetType="local:KeyVisual" BasedOn="{StaticResource DefaultTextKeyVisualStyle}">
<Setter Property="MinWidth" Value="40" />
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
<Setter Property="Height" Value="36" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Padding" Value="8,0,8,2" />
<Setter Property="FontSize" Value="13" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style x:Key="DefaultIconKeyVisualStyle" TargetType="local:KeyVisual" BasedOn="{StaticResource DefaultTextKeyVisualStyle}">
<Setter Property="MinWidth" Value="56" />
<Setter Property="MinHeight" Value="48" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="Padding" Value="16,8,16,8" />
<Setter Property="FontSize" Value="14" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style x:Key="SmallIconKeyVisualStyle" TargetType="local:KeyVisual" BasedOn="{StaticResource DefaultTextKeyVisualStyle}">
<Setter Property="MinWidth" Value="40" />
<Setter Property="Height" Value="36" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="10" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style x:Key="SmallOutlineIconKeyVisualStyle" TargetType="local:KeyVisual" BasedOn="{StaticResource DefaultTextKeyVisualStyle}">
<Setter Property="MinWidth" Value="40" />
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="Height" Value="36" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="9" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
</ResourceDictionary>

View File

@ -0,0 +1,49 @@
<UserControl
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutControl"
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.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d"
x:Name="LayoutRoot"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid HorizontalAlignment="Right">
<StackPanel Orientation="Horizontal">
<Button x:Name="EditButton"
Background="Transparent"
BorderBrush="Transparent"
Click="OpenDialogButton_Click" >
<StackPanel Orientation="Horizontal"
Spacing="16">
<ItemsControl x:Name="PreviewKeysControl"
IsEnabled="{Binding ElementName=EditButton, Path=IsEnabled}"
VerticalAlignment="Center"
IsTabStop="False">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:KeyVisual IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
VisualType="Small"
VerticalAlignment="Center"
Content="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<FontIcon Glyph="&#xE104;"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="14"
Margin="0,0,4,0" />
</StackPanel>
</Button>
</StackPanel>
</Grid>
</UserControl>

View File

@ -5,33 +5,39 @@
using System;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Windows.ApplicationModel.Resources;
using Windows.System.Diagnostics;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Automation;
using Windows.UI.Xaml.Automation.Peers;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
public sealed partial class HotkeySettingsControl : UserControl, IDisposable
public sealed partial class ShortcutControl : UserControl, IDisposable
{
private readonly UIntPtr ignoreKeyEventFlag = (UIntPtr)0x5555;
private bool _shiftKeyDownOnEntering;
private bool _shiftToggled;
private bool _enabled;
private HotkeySettings hotkeySettings;
private HotkeySettings internalSettings;
private HotkeySettings lastValidSettings;
private HotkeySettingsControlHook hook;
private bool _isActive;
private bool disposedValue;
public string Header { get; set; }
public string Keys { get; set; }
public static readonly DependencyProperty IsActiveProperty =
DependencyProperty.Register(
"Enabled",
typeof(bool),
typeof(HotkeySettingsControl),
null);
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register("Enabled", typeof(bool), typeof(ShortcutControl), null);
public static readonly DependencyProperty HotkeySettingsProperty = DependencyProperty.Register("HotkeySettings", typeof(HotkeySettings), typeof(ShortcutControl), null);
private bool _enabled;
private ShortcutDialogContentControl c = new ShortcutDialogContentControl();
private ContentDialog shortcutDialog;
public bool Enabled
{
@ -47,35 +53,15 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
if (value)
{
HotkeyTextBox.IsEnabled = true;
// TitleText.IsActive = "True";
// TitleGlyph.IsActive = "True";
EditButton.IsEnabled = true;
}
else
{
HotkeyTextBox.IsEnabled = false;
// TitleText.IsActive = "False";
// TitleGlyph.IsActive = "False";
EditButton.IsEnabled = false;
}
}
}
public static readonly DependencyProperty HotkeySettingsProperty =
DependencyProperty.Register(
"HotkeySettings",
typeof(HotkeySettings),
typeof(HotkeySettingsControl),
null);
private HotkeySettings hotkeySettings;
private HotkeySettings internalSettings;
private HotkeySettings lastValidSettings;
private HotkeySettingsControlHook hook;
private bool _isActive;
private bool disposedValue;
public HotkeySettings HotkeySettings
{
get
@ -89,24 +75,43 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
{
hotkeySettings = value;
SetValue(HotkeySettingsProperty, value);
HotkeyTextBox.Text = HotkeySettings.ToString();
PreviewKeysControl.ItemsSource = HotkeySettings.GetKeysList();
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
c.Keys = HotkeySettings.GetKeysList();
}
}
}
public HotkeySettingsControl()
public ShortcutControl()
{
InitializeComponent();
internalSettings = new HotkeySettings();
HotkeyTextBox.GettingFocus += HotkeyTextBox_GettingFocus;
HotkeyTextBox.LosingFocus += HotkeyTextBox_LosingFocus;
HotkeyTextBox.Unloaded += HotkeyTextBox_Unloaded;
this.Unloaded += ShortcutControl_Unloaded;
hook = new HotkeySettingsControlHook(Hotkey_KeyDown, Hotkey_KeyUp, Hotkey_IsActive, FilterAccessibleKeyboardEvents);
ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView();
// We create the Dialog in C# because doing it in XAML is giving WinUI/XAML Island bugs when using dark theme.
shortcutDialog = new ContentDialog
{
XamlRoot = this.XamlRoot,
Title = resourceLoader.GetString("Activation_Shortcut_Title"),
Content = c,
PrimaryButtonText = resourceLoader.GetString("Activation_Shortcut_Save"),
CloseButtonText = resourceLoader.GetString("Activation_Shortcut_Cancel"),
DefaultButton = ContentDialogButton.Primary,
};
shortcutDialog.PrimaryButtonClick += ShortcutDialog_PrimaryButtonClick;
shortcutDialog.Opened += ShortcutDialog_Opened;
shortcutDialog.Closing += ShortcutDialog_Closing;
}
private void HotkeyTextBox_Unloaded(object sender, RoutedEventArgs e)
private void ShortcutControl_Unloaded(object sender, RoutedEventArgs e)
{
shortcutDialog.PrimaryButtonClick -= ShortcutDialog_PrimaryButtonClick;
shortcutDialog.Opened -= ShortcutDialog_Opened;
shortcutDialog.Closing -= ShortcutDialog_Closing;
// Dispose the HotkeySettingsControlHook object to terminate the hook threads when the textbox is unloaded
hook.Dispose();
}
@ -137,7 +142,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
break;
case Windows.System.VirtualKey.Escape:
internalSettings = new HotkeySettings();
HotkeySettings = new HotkeySettings();
shortcutDialog.IsPrimaryButtonEnabled = false;
return;
default:
internalSettings.Code = matchValueCode;
@ -224,6 +229,12 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
}
}
// Either the cancel or save button has keyboard focus.
if (FocusManager.GetFocusedElement(LayoutRoot.XamlRoot).GetType() == typeof(Button))
{
return false;
}
return true;
}
@ -233,15 +244,62 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
{
KeyEventHandler(key, true, key);
c.Keys = internalSettings.GetKeysList();
if (internalSettings.GetKeysList().Count == 0)
{
// Empty, disable save button
shortcutDialog.IsPrimaryButtonEnabled = false;
}
else if (internalSettings.GetKeysList().Count == 1)
{
// 1 key, disable save button
shortcutDialog.IsPrimaryButtonEnabled = false;
// Check if the one key is a hotkey
if (internalSettings.Shift || internalSettings.Win || internalSettings.Alt || internalSettings.Ctrl)
{
c.IsError = false;
}
else
{
c.IsError = true;
}
}
// Tab and Shift+Tab are accessible keys and should not be displayed in the hotkey control.
if (internalSettings.Code > 0 && !internalSettings.IsAccessibleShortcut())
{
HotkeyTextBox.Text = internalSettings.ToString();
lastValidSettings = internalSettings.Clone();
if (!ComboIsValid(lastValidSettings))
{
DisableKeys();
}
else
{
EnableKeys();
}
}
});
}
private void EnableKeys()
{
shortcutDialog.IsPrimaryButtonEnabled = true;
c.IsError = false;
// WarningLabel.Style = (Style)App.Current.Resources["SecondaryTextStyle"];
}
private void DisableKeys()
{
shortcutDialog.IsPrimaryButtonEnabled = false;
c.IsError = true;
// WarningLabel.Style = (Style)App.Current.Resources["SecondaryWarningTextStyle"];
}
private async void Hotkey_KeyUp(int key)
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
@ -255,8 +313,19 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
return _isActive;
}
private void HotkeyTextBox_GettingFocus(object sender, RoutedEventArgs e)
#pragma warning disable CA1801 // Review unused parameters
private void ShortcutDialog_Opened(ContentDialog sender, ContentDialogOpenedEventArgs args)
#pragma warning restore CA1801 // Review unused parameters
{
if (!ComboIsValid(hotkeySettings))
{
DisableKeys();
}
else
{
EnableKeys();
}
// Reset the status on entering the hotkey each time.
_shiftKeyDownOnEntering = false;
_shiftToggled = false;
@ -270,30 +339,45 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
_isActive = true;
}
private void HotkeyTextBox_LosingFocus(object sender, RoutedEventArgs e)
private async void OpenDialogButton_Click(object sender, RoutedEventArgs e)
{
if (lastValidSettings != null && (lastValidSettings.IsValid() || lastValidSettings.IsEmpty()))
c.Keys = null;
c.Keys = HotkeySettings.GetKeysList();
shortcutDialog.XamlRoot = this.XamlRoot;
await shortcutDialog.ShowAsync();
}
#pragma warning disable CA1801 // Review unused parameters
private void ShortcutDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
#pragma warning restore CA1801 // Review unused parameters
{
if (ComboIsValid(lastValidSettings))
{
HotkeySettings = lastValidSettings.Clone();
}
HotkeyTextBox.Text = hotkeySettings.ToString();
if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
PreviewKeysControl.ItemsSource = hotkeySettings.GetKeysList();
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
shortcutDialog.Hide();
}
private static bool ComboIsValid(HotkeySettings settings)
{
if (settings != null && (settings.IsValid() || settings.IsEmpty()))
{
TextBoxAutomationPeer peer =
FrameworkElementAutomationPeer.FromElement(HotkeyTextBox) as TextBoxAutomationPeer;
string textBoxChangeActivityId = "textBoxChangedOnLosingFocus";
if (peer != null)
{
peer.RaiseNotificationEvent(
AutomationNotificationKind.ActionCompleted,
AutomationNotificationProcessing.ImportantMostRecent,
HotkeyTextBox.Text,
textBoxChangeActivityId);
}
return true;
}
else
{
return false;
}
}
#pragma warning disable CA1801 // Review unused parameters
private void ShortcutDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args)
#pragma warning restore CA1801 // Review unused parameters
{
_isActive = false;
}

View File

@ -0,0 +1,103 @@
<UserControl
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutDialogContentControl"
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.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
mc:Ignorable="d"
x:Name="ShortcutContentControl">
<UserControl.Resources>
<converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" FalseValue="Collapsed" TrueValue="Visible" />
</UserControl.Resources>
<Grid MinWidth="498" MinHeight="220">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition MinHeight="110"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock x:Uid="Activation_Shortcut_Description" Grid.Row="0" />
<ItemsControl x:Name="KeysControl"
Height="56"
Grid.Row="1"
Margin="0,64,0,0"
HorizontalContentAlignment="Center"
ItemsSource="{x:Bind Keys, Mode=OneWay}"
HorizontalAlignment="Center"
VerticalAlignment="Top">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="8"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:KeyVisual AutomationProperties.AccessibilityView="Raw"
Height="56"
VisualType="Large"
IsError="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
IsTabStop="False"
Content="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<StackPanel Orientation="Vertical"
Grid.Row="2"
Spacing="8"
Margin="0,24,0,0"
VerticalAlignment="Top">
<Grid Height="36">
<Border x:Name="WarningBanner"
Background="{ThemeResource InfoBarErrorSeverityBackgroundBrush}"
CornerRadius="{ThemeResource ControlCornerRadius}"
BorderBrush="{ThemeResource InfoBarBorderBrush}"
BorderThickness="{ThemeResource InfoBarBorderThickness}"
Padding="8"
Margin="-2,0,0,0"
Visibility="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay, Converter={StaticResource boolToVisibilityConverter}}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- To do: replace with InfoBadge once we move towards WinUI 2.7 -->
<Grid VerticalAlignment="Center" Margin="2,0,12,0" AutomationProperties.AccessibilityView="Raw">
<TextBlock x:Name="IconBackground"
VerticalAlignment="Center"
FontSize="{StaticResource InfoBarIconFontSize}"
Text="{StaticResource InfoBarIconBackgroundGlyph}"
Foreground="{ThemeResource InfoBarErrorSeverityIconBackground}"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
AutomationProperties.AccessibilityView="Raw" />
<TextBlock x:Name="StandardIcon"
FontSize="{StaticResource InfoBarIconFontSize}"
Text="{StaticResource InfoBarErrorIconGlyph}"
Foreground="{ThemeResource InfoBarErrorSeverityIconForeground}"
FontFamily="{ThemeResource SymbolThemeFontFamily}"/>
</Grid>
<TextBlock x:Name="InvalidShortcutWarningLabel"
x:Uid="InvalidShortcut"
Foreground="{ThemeResource InfoBarTitleForeground}"
FontWeight="{ThemeResource InfoBarTitleFontWeight}"
Grid.Column="1" />
</Grid>
</Border>
</Grid>
<toolkitcontrols:MarkdownTextBlock x:Uid="InvalidShortcutWarningLabel"
FontSize="12"
Background="Transparent"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
</StackPanel>
</Grid>
</UserControl>

View File

@ -0,0 +1,48 @@
// 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 System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.PowerToys.Settings.UI.Library;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
public sealed partial class ShortcutDialogContentControl : UserControl
{
public ShortcutDialogContentControl()
{
this.InitializeComponent();
}
#pragma warning disable CA2227 // Collection properties should be read only
public List<object> Keys
#pragma warning restore CA2227 // Collection properties should be read only
{
get { return (List<object>)GetValue(KeysProperty); }
set { SetValue(KeysProperty, value); }
}
public static readonly DependencyProperty KeysProperty = DependencyProperty.Register("Keys", typeof(List<object>), typeof(SettingsPageControl), new PropertyMetadata(default(string)));
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
}
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register("IsError", typeof(bool), typeof(ShortcutDialogContentControl), new PropertyMetadata(false));
}
}

View File

@ -0,0 +1,44 @@
<UserControl
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutWithTextLabelControl"
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.Controls"
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:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ItemsControl AutomationProperties.AccessibilityView="Raw"
ItemsSource="{x:Bind Keys}"
VerticalAlignment="Center"
IsTabStop="False">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
VisualType="SmallOutline"
VerticalAlignment="Center"
Content="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<toolkitcontrols:MarkdownTextBlock Background="Transparent"
Text="{x:Bind Text}"
Margin="8,0,0,0"
Grid.Column="1"
VerticalAlignment="Center" />
</Grid>
</UserControl>

View File

@ -0,0 +1,47 @@
// 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 System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
public sealed partial class ShortcutWithTextLabelControl : UserControl
{
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ShortcutWithTextLabelControl), new PropertyMetadata(default(string)));
#pragma warning disable CA2227 // Collection properties should be read only
public List<object> Keys
#pragma warning restore CA2227 // Collection properties should be read only
{
get { return (List<object>)GetValue(KeysProperty); }
set { SetValue(KeysProperty, value); }
}
public static readonly DependencyProperty KeysProperty = DependencyProperty.Register("Keys", typeof(List<object>), typeof(ShortcutWithTextLabelControl), new PropertyMetadata(default(string)));
public ShortcutWithTextLabelControl()
{
this.InitializeComponent();
}
}
}

View File

@ -1,11 +0,0 @@
<UserControl x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutTextControl"
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.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<TextBlock x:Name="ContentText" TextWrapping="Wrap" />
</UserControl>

View File

@ -1,60 +0,0 @@
// 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 System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text.RegularExpressions;
using Windows.UI.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Documents;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
public sealed partial class ShortcutTextControl : UserControl
{
public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
public ShortcutTextControl()
{
this.InitializeComponent();
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ShortcutVisualControl), new PropertyMetadata(default(string), (s, e) =>
{
var self = (ShortcutTextControl)s;
var parts = Regex.Split(e.NewValue.ToString(), @"({[\s\S]+?})").Where(l => !string.IsNullOrEmpty(l)).ToArray();
foreach (var seg in parts)
{
if (!string.IsNullOrWhiteSpace(seg))
{
if (seg.Contains("{", StringComparison.InvariantCulture))
{
Run key = new Run()
{
Text = Regex.Replace(seg, @"[{}]", string.Empty),
FontWeight = FontWeights.SemiBold,
};
self.ContentText.Inlines.Add(key);
}
else
{
Run description = new Run()
{
Text = seg,
FontWeight = FontWeights.Normal,
};
self.ContentText.Inlines.Add(description);
}
}
}
}));
}
}

View File

@ -1,15 +0,0 @@
<UserControl x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutVisualControl"
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.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<controls:WrapPanel x:Name="contentPanel"
Orientation="Horizontal"
HorizontalSpacing="4" />
</UserControl>

View File

@ -1,62 +0,0 @@
// 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 System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text.RegularExpressions;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
public sealed partial class ShortcutVisualControl : UserControl
{
public ShortcutVisualControl()
{
InitializeComponent();
}
public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ShortcutVisualControl), new PropertyMetadata(default(string), (s, e) =>
{
var self = (ShortcutVisualControl)s;
var parts = Regex.Split(e.NewValue.ToString(), @"({[\s\S]+?})").Where(l => !string.IsNullOrEmpty(l)).ToArray();
foreach (var seg in parts)
{
if (!string.IsNullOrWhiteSpace(seg))
{
if (seg.Contains("{", StringComparison.InvariantCulture))
{
KeyVisual k = new KeyVisual
{
Content = Regex.Replace(seg, @"[{}]", string.Empty),
VerticalAlignment = VerticalAlignment.Center,
};
self.contentPanel.Children.Add(k);
}
else
{
TextBlock t = new TextBlock
{
Text = seg,
TextWrapping = TextWrapping.Wrap,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0, 6, 0, 0),
};
self.contentPanel.Children.Add(t);
}
}
}
}));
}
}

View File

@ -95,18 +95,18 @@
</Compile>
<Compile Include="Behaviors\NavigationViewHeaderBehavior.cs" />
<Compile Include="Behaviors\NavigationViewHeaderMode.cs" />
<Compile Include="Controls\HotkeySettingsControl.xaml.cs">
<DependentUpon>HotkeySettingsControl.xaml</DependentUpon>
<Compile Include="Controls\ShortcutControl\ShortcutControl.xaml.cs">
<DependentUpon>ShortcutControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\KeyVisual\KeyVisual.cs" />
<Compile Include="Controls\SettingExpander\SettingExpander.cs" />
<Compile Include="Controls\SettingsGroup\SettingsGroup.cs" />
<Compile Include="Controls\Setting\Setting.cs" />
<Compile Include="Controls\ShortcutTextControl.xaml.cs">
<DependentUpon>ShortcutTextControl.xaml</DependentUpon>
<Compile Include="Controls\ShortcutControl\ShortcutDialogContentControl.xaml.cs">
<DependentUpon>ShortcutDialogContentControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ShortcutVisualControl.xaml.cs">
<DependentUpon>ShortcutVisualControl.xaml</DependentUpon>
<Compile Include="Controls\ShortcutControl\ShortcutWithTextLabelControl.xaml.cs">
<DependentUpon>ShortcutWithTextLabelControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\SettingsPageControl\SettingsPageControl.xaml.cs">
<DependentUpon>SettingsPageControl.xaml</DependentUpon>
@ -305,7 +305,7 @@
<PRIResource Include="Strings\*\Resources.resw" />
</ItemGroup>
<ItemGroup>
<Page Include="Controls\HotkeySettingsControl.xaml">
<Page Include="Controls\ShortcutControl\ShortcutControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
@ -321,11 +321,11 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ShortcutTextControl.xaml">
<Page Include="Controls\ShortcutControl\ShortcutDialogContentControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ShortcutVisualControl.xaml">
<Page Include="Controls\ShortcutControl\ShortcutWithTextLabelControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>

View File

@ -5,7 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls">
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
@ -16,12 +17,12 @@
<TextBlock x:Uid="Oobe_HowToUse"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_Awake_HowToUse" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_Awake_HowToUse" />
<TextBlock x:Uid="Oobe_TipsAndTricks"
Style="{ThemeResource OobeSubtitleStyle}"/>
<controls:ShortcutTextControl x:Uid="Oobe_Awake_TipsAndTricks" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_Awake_TipsAndTricks" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"

View File

@ -10,9 +10,6 @@ using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class OobeAwake : Page
{
public OobePowerToysModule ViewModel { get; set; }

View File

@ -6,7 +6,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls">
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
@ -17,13 +18,14 @@
<TextBlock x:Uid="Oobe_HowToUse"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_ColorPicker_HowToUse" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_ColorPicker_HowToUse" />
<TextBlock x:Uid="Oobe_TipsAndTricks"
Style="{ThemeResource OobeSubtitleStyle}"/>
<controls:ShortcutTextControl x:Uid="Oobe_ColorPicker_TipsAndTricks" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_ColorPicker_TipsAndTricks" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="Launch_ColorPicker" Style="{StaticResource AccentButtonStyle}" Click="Start_ColorPicker_Click"/>
<Button x:Uid="OOBE_Settings"

View File

@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Threading;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
using Microsoft.PowerToys.Settings.UI.Views;
@ -11,9 +12,6 @@ using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class OobeColorPicker : Page
{
public OobePowerToysModule ViewModel { get; set; }
@ -51,6 +49,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.LogOpeningModuleEvent();
HotkeyControl.Keys = SettingsRepository<ColorPickerSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.ActivationShortcut.GetKeysList();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)

View File

@ -2,28 +2,30 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeFancyZones"
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.OOBE.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"
mc:Ignorable="d">
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
ModuleDescription="{x:Bind ViewModel.Description}">
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
ModuleDescription="{x:Bind ViewModel.Description}">
<controls:OOBEPageControl.ModuleContent>
<StackPanel Orientation="Vertical">
<TextBlock x:Uid="Oobe_HowToUse"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_FancyZones_HowToUse" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_FancyZones_HowToUse" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_FancyZones_HowToUse_Shortcut" />
<TextBlock x:Uid="Oobe_TipsAndTricks"
Style="{ThemeResource OobeSubtitleStyle}"/>
<controls:ShortcutTextControl x:Uid="Oobe_FancyZones_TipsAndTricks" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_FancyZones_TipsAndTricks" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"
Click="SettingsLaunchButton_Click"/>

View File

@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
using Microsoft.PowerToys.Settings.UI.Views;
@ -10,9 +11,6 @@ using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class OobeFancyZones : Page
{
public OobePowerToysModule ViewModel { get; set; }
@ -37,6 +35,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.LogOpeningModuleEvent();
HotkeyControl.Keys = SettingsRepository<FancyZonesSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.FancyzonesEditorHotkey.Value.GetKeysList();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)

View File

@ -5,6 +5,7 @@
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:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
@ -16,7 +17,7 @@
<TextBlock x:Uid="Oobe_HowToEnable"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_FileExplorer_HowToEnable" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_FileExplorer_HowToEnable" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"

View File

@ -5,8 +5,9 @@
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.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"
mc:Ignorable="d">
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
@ -17,12 +18,12 @@
<TextBlock x:Uid="Oobe_HowToLaunch"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_ImageResizer_HowToLaunch" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_ImageResizer_HowToLaunch" />
<TextBlock x:Uid="Oobe_TipsAndTricks"
Style="{ThemeResource OobeSubtitleStyle}"/>
<controls:ShortcutTextControl x:Uid="Oobe_ImageResizer_TipsAndTricks" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_ImageResizer_TipsAndTricks" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"

View File

@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
@ -15,12 +15,12 @@
<TextBlock x:Uid="Oobe_HowToCreateMappings"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_KBM_HowToCreateMappings" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_KBM_HowToCreateMappings" />
<TextBlock x:Uid="Oobe_TipsAndTricks"
Style="{ThemeResource OobeSubtitleStyle}"/>
<controls:ShortcutTextControl x:Uid="Oobe_KBM_TipsAndTricks" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_KBM_TipsAndTricks" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"

View File

@ -5,6 +5,7 @@
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:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
@ -15,12 +16,12 @@
<TextBlock x:Uid="Oobe_HowToUse"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_PowerRename_HowToUse" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_PowerRename_HowToUse" />
<TextBlock x:Uid="Oobe_TipsAndTricks"
Style="{ThemeResource OobeSubtitleStyle}"/>
<controls:ShortcutTextControl x:Uid="Oobe_PowerRename_TipsAndTricks" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_PowerRename_TipsAndTricks" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"

View File

@ -5,8 +5,8 @@
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.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"
mc:Ignorable="d">
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
@ -17,12 +17,12 @@
<TextBlock x:Uid="Oobe_HowToLaunch"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_Run_HowToLaunch" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_Run_HowToLaunch" />
<TextBlock x:Uid="Oobe_TipsAndTricks"
Style="{ThemeResource OobeSubtitleStyle}"/>
<controls:ShortcutTextControl x:Uid="Oobe_Run_TipsAndTricks" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_Run_TipsAndTricks" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="Launch_Run" Style="{StaticResource AccentButtonStyle}" Click="Start_Run_Click"/>

View File

@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Threading;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
using Microsoft.PowerToys.Settings.UI.Views;
@ -51,6 +52,8 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.LogOpeningModuleEvent();
HotkeyControl.Keys = SettingsRepository<PowerLauncherSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.OpenPowerLauncher.GetKeysList();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)

View File

@ -233,9 +233,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
public void UpdateUITheme()
{
var settingsUtils = new SettingsUtils();
var generalSettings = SettingsRepository<GeneralSettings>.GetInstance(settingsUtils);
switch (generalSettings.SettingsConfig.Theme.ToUpperInvariant())
switch (SettingsRepository<GeneralSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Theme.ToUpperInvariant())
{
case "LIGHT":
this.RequestedTheme = ElementTheme.Light;

View File

@ -5,8 +5,9 @@
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.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"
mc:Ignorable="d">
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
ModuleDescription="{x:Bind ViewModel.Description}">
@ -16,7 +17,7 @@
<TextBlock x:Uid="Oobe_HowToLaunch"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_ShortcutGuide_HowToLaunch" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_ShortcutGuide_HowToLaunch" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="Launch_ShortcutGuide" Style="{StaticResource AccentButtonStyle}" Click="Start_ShortcutGuide_Click"/>

View File

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
using Microsoft.PowerToys.Settings.UI.Views;
@ -54,6 +55,8 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.LogOpeningModuleEvent();
HotkeyControl.Keys = SettingsRepository<ShortcutGuideSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.OpenShortcutGuide.GetKeysList();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)

View File

@ -5,8 +5,9 @@
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.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"
mc:Ignorable="d">
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
@ -17,7 +18,11 @@
<TextBlock x:Uid="Oobe_HowToLaunch"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_VideoConference_HowToLaunch" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyMicVidControl" x:Uid="Oobe_VideoConference_ToggleMicVid" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyMicControl" x:Uid="Oobe_VideoConference_ToggleMic" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyVidControl" x:Uid="Oobe_VideoConference_ToggleMic" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_VideoConference_HowToLaunch" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"

View File

@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
using Windows.UI.Xaml.Controls;
@ -31,6 +32,9 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.LogOpeningModuleEvent();
HotkeyMicVidControl.Keys = SettingsRepository<VideoConferenceSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.MuteCameraAndMicrophoneHotkey.Value.GetKeysList();
HotkeyMicControl.Keys = SettingsRepository<VideoConferenceSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.MuteMicrophoneHotkey.Value.GetKeysList();
HotkeyVidControl.Keys = SettingsRepository<VideoConferenceSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.MuteCameraHotkey.Value.GetKeysList();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)

View File

@ -847,10 +847,6 @@
<data name="General_RunAsAdminRequired.Title" xml:space="preserve">
<value>You need to run as administrator to use this setting.</value>
</data>
<data name="ShortcutWarningLabel.Text" xml:space="preserve">
<value>Only shortcuts with the following hotkeys are valid:</value>
<comment>keyboard shortcuts and</comment>
</data>
<data name="FancyZones_RestoreSize.Content" xml:space="preserve">
<value>Restore the original size of windows when unsnapping</value>
</data>
@ -1170,6 +1166,9 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="Activation_Shortcut.Header" xml:space="preserve">
<value>Activation shortcut</value>
</data>
<data name="Activation_Shortcut.Description" xml:space="preserve">
<value>Customize the keyboard shortcut to activate this module</value>
</data>
<data name="Oobe_GetStarted.Text" xml:space="preserve">
<value>Let's get started!</value>
</data>
@ -1230,19 +1229,22 @@ Take a moment to preview the various utilities listed or view our comprehensive
<value>Release notes</value>
</data>
<data name="Oobe_ColorPicker_HowToUse.Text" xml:space="preserve">
<value>{Win} + {Shift} + {C} to open Color Picker.</value>
<value>to open Color Picker.</value>
</data>
<data name="Oobe_ColorPicker_TipsAndTricks.Text" xml:space="preserve">
<value>To select a color with more precision, {scroll the mouse wheel} to zoom in.</value>
<value>To select a color with more precision, **scroll the mouse wheel** to zoom in.</value>
</data>
<data name="Oobe_FancyZones_HowToUse.Text" xml:space="preserve">
<value>{Shift} + {dragging the window} to snap a window to a zone, and release the window in the desired zone. {Win} + {Shift} + {`} to open the FancyZones editor.</value>
<value>**Shift** + **drag the window** to snap a window to a zone, and release the window in the desired zone.</value>
</data>
<data name="Oobe_FancyZones_HowToUse_Shortcut.Text" xml:space="preserve">
<value>to open the FancyZones editor.</value>
</data>
<data name="Oobe_FancyZones_TipsAndTricks.Text" xml:space="preserve">
<value>Snap a window to multiple zones by holding the {Ctrl} key (while also holding {Shift}) when dragging a window.</value>
<value>Snap a window to multiple zones by holding the **Ctrl** key (while also holding **Shift**) when dragging a window.</value>
</data>
<data name="Oobe_FileExplorer_HowToEnable.Text" xml:space="preserve">
<value>Open File Explorer, {select the View tab} in the File Explorer ribbon, then {select Preview Pane}.
<value>Open File Explorer, **select the View tab** in the File Explorer ribbon, then **select Preview Pane**.
From there, simply click on a Markdown file or SVG icon in the File Explorer and observe the content on the preview pane!</value>
</data>
<data name="Oobe_HowToCreateMappings.Text" xml:space="preserve">
@ -1258,39 +1260,43 @@ From there, simply click on a Markdown file or SVG icon in the File Explorer and
<value>How to use</value>
</data>
<data name="Oobe_ImageResizer_HowToLaunch.Text" xml:space="preserve">
<value>In File Explorer, {right-clicking one or more image files} and {clicking on Resize pictures} from the context menu.</value>
<value>In File Explorer, **right-clicking one or more image files** and **clicking on Resize pictures** from the context menu.</value>
</data>
<data name="Oobe_ImageResizer_TipsAndTricks.Text" xml:space="preserve">
<value>Want a custom size? You can add them in the PowerToys Settings!</value>
</data>
<data name="Oobe_KBM_HowToCreateMappings.Text" xml:space="preserve">
<value>Launch {PowerToys settings}, navigate to the Keyboard Manager menu, and select either {Remap a key} or {Remap a shortcut}.</value>
<value>Launch **PowerToys settings**, navigate to the Keyboard Manager menu, and select either **Remap a key** or **Remap a shortcut**.</value>
</data>
<data name="Oobe_KBM_TipsAndTricks.Text" xml:space="preserve">
<value>Want to only have a shortcut work for a single application? Use the Target App field when creating the shortcut remapping.</value>
</data>
<data name="Oobe_PowerRename_HowToUse.Text" xml:space="preserve">
<value>In File Explorer, {right-clicking one or more selected files} and {clicking on PowerRename} from the context menu.</value>
<value>In File Explorer, **right-clicking one or more selected files** and **clicking on PowerRename** from the context menu.</value>
</data>
<data name="Oobe_PowerRename_TipsAndTricks.Text" xml:space="preserve">
<value>PowerRename supports searching for files using regular expressions to enable more advanced renaming functionalities.</value>
</data>
<data name="Oobe_Run_HowToLaunch.Text" xml:space="preserve">
<value>{Alt} + {Space} to open Run and just start typing.</value>
<value>to open Run and just start typing.</value>
</data>
<data name="Oobe_Run_TipsAndTricks.Text" xml:space="preserve">
<value>PowerToys Run supports various action keys to funnel search queries for a specific subset of results. Typing {&lt;} searches for running processes only, {?} will search only for file, or {.} for installed applications! See PowerToys documentation for the complete set of 'Action Keys' available.</value>
<value>PowerToys Run supports various action keys to funnel search queries for a specific subset of results. Typing **&lt;** searches for running processes only, **?** will search only for file, or **.** for installed applications! See PowerToys documentation for the complete set of 'Action Keys' available.</value>
</data>
<data name="Oobe_ShortcutGuide_HowToLaunch.Text" xml:space="preserve">
<value>{Win} + {?} to open Shortcut Guide, press it again to close or press {Esc}. You can also launch it by holding the {Win} key for one second!</value>
<value>to open Shortcut Guide, press it again to close or press **Esc**.</value>
</data>
<data name="Oobe_TipsAndTricks.Text" xml:space="preserve">
<value>Tips &amp; tricks</value>
</data>
<data name="Oobe_VideoConference_HowToLaunch.Text" xml:space="preserve">
<value>{Win} + {N} to toggle both your microphone and video
{Win} + {Shift} + {A} to toggle your microphone
{Win} + {Shift} + {O} to toggle your video</value>
<data name="Oobe_VideoConference_ToggleMicVid.Text" xml:space="preserve">
<value>to toggle both your microphone and video</value>
</data>
<data name="Oobe_VideoConference_ToggleMic.Text" xml:space="preserve">
<value>to toggle your microphone</value>
</data>
<data name="Oobe_VideoConference_ToggleVid.Text" xml:space="preserve">
<value>to toggle your video</value>
</data>
<data name="Oobe_ColorPicker" xml:space="preserve">
<value>Color Picker</value>
@ -1574,6 +1580,24 @@ From there, simply click on a Markdown file or SVG icon in the File Explorer and
<data name="RemoveTooltip.Text" xml:space="preserve">
<value>Remove</value>
</data>
<data name="Activation_Shortcut_Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Activation_Shortcut_Description.Text" xml:space="preserve">
<value>Press a combination of keys to change this shortcut</value>
</data>
<data name="Activation_Shortcut_Save" xml:space="preserve">
<value>Save</value>
</data>
<data name="Activation_Shortcut_Title" xml:space="preserve">
<value>Activation shortcut</value>
</data>
<data name="InvalidShortcut.Text" xml:space="preserve">
<value>Invalid shortcut</value>
</data>
<data name="InvalidShortcutWarningLabel.Text" xml:space="preserve">
<value>Only shortcuts that start with **Windows key**, **Ctrl**, **Alt** or **Shift** are valid.</value>
</data>
<data name="FancyZones_SpanZonesAcrossMonitorsPrerequisites.Text" xml:space="preserve">
<value>All monitors must have the same DPI scaling and will be treated as one large combined rectangle which contains all monitors.</value>
</data>

View File

@ -7,6 +7,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:models="using:Microsoft.PowerToys.Settings.UI.Library"
mc:Ignorable="d"
x:Name="RootPage"
AutomationProperties.LandmarkType="Main">
<controls:SettingsPageControl x:Uid="ColorPicker"
@ -27,14 +28,9 @@
<controls:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<controls:Setting x:Uid="Activation_Shortcut" Icon="&#xEDA7;">
<controls:Setting.Description>
<TextBlock>
<Run x:Uid="ShortcutWarningLabel"/>
<Run Text="Win, Ctrl, Alt, Shift"/>
</TextBlock>
</controls:Setting.Description>
<controls:Setting.ActionContent>
<controls:HotkeySettingsControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" Keys="Win, Ctrl, Alt, Shift"/>
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}"
HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}"/>
</controls:Setting.ActionContent>
</controls:Setting>

View File

@ -46,16 +46,9 @@
<controls:SettingExpander IsExpanded="True">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="Activation_Shortcut" Icon="&#xEDA7;" Style="{StaticResource ExpanderHeaderSettingStyle}">
<controls:Setting.Description>
<TextBlock>
<Run x:Uid="ShortcutWarningLabel"/>
<Run Text="Win, Ctrl, Alt, Shift"/>
</TextBlock>
</controls:Setting.Description>
<controls:Setting.ActionContent>
<controls:HotkeySettingsControl MinWidth="{StaticResource SettingActionControlMinWidth}"
HotkeySettings="{x:Bind Path=ViewModel.EditorHotkey, Mode=TwoWay}"
Keys="Win, Ctrl, Alt, Shift"/>
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}"
HotkeySettings="{x:Bind Path=ViewModel.EditorHotkey, Mode=TwoWay}"/>
</controls:Setting.ActionContent>
</controls:Setting>
</controls:SettingExpander.Header>

View File

@ -19,37 +19,11 @@
<DataTemplate x:Key="OriginalKeyTemplate" x:DataType="x:String">
<Border Background="{ThemeResource ButtonBackground}"
BorderBrush="{ThemeResource ButtonBorderBrush}"
BorderThickness="{ThemeResource ButtonBorderThemeThickness}"
CornerRadius="{ThemeResource ControlCornerRadius}"
Padding="{ThemeResource ButtonPadding}"
VerticalAlignment="Center"
HorizontalAlignment="Left">
<TextBlock FontWeight="SemiBold"
Foreground="{ThemeResource ButtonForeground}"
VerticalAlignment="Center"
TextAlignment="Center"
FontSize="12"
Text="{Binding}" />
</Border>
<controls:KeyVisual Content="{Binding}" VisualType="SmallOutline" />
</DataTemplate>
<DataTemplate x:Key="RemappedKeyTemplate" x:DataType="x:String">
<Border Background="{ThemeResource ButtonBackground}"
BorderBrush="{ThemeResource AccentButtonBackground}"
BorderThickness="{ThemeResource ButtonBorderThemeThickness}"
CornerRadius="{ThemeResource ControlCornerRadius}"
Padding="{ThemeResource ButtonPadding}"
VerticalAlignment="Center"
HorizontalAlignment="Left">
<TextBlock FontWeight="SemiBold"
Foreground="{ThemeResource AccentButtonBackground}"
VerticalAlignment="Center"
TextAlignment="Center"
FontSize="12"
Text="{Binding}" />
</Border>
<controls:KeyVisual Content="{Binding}" VisualType="Small" />
</DataTemplate>
<!--<DataTemplate x:Name="KeysListViewTemplate" x:DataType="Lib:KeysDataModel">

View File

@ -37,15 +37,8 @@
<controls:SettingExpander IsExpanded="True">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="Activation_Shortcut" Icon="&#xEDA7;" Style="{StaticResource ExpanderHeaderSettingStyle}">
<controls:Setting.Description>
<TextBlock>
<Run x:Uid="ShortcutWarningLabel"/>
<Run Text="Win, Ctrl, Alt, Shift"/>
</TextBlock>
</controls:Setting.Description>
<controls:Setting.ActionContent>
<controls:HotkeySettingsControl HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}"
Keys="Win, Ctrl, Alt, Shift"
<controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}"
MinWidth="{StaticResource SettingActionControlMinWidth}"/>
</controls:Setting.ActionContent>
</controls:Setting>

View File

@ -30,15 +30,8 @@
<controls:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<controls:Setting x:Uid="Activation_Shortcut" Icon="&#xEDA7;" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<controls:Setting.Description>
<TextBlock>
<Run x:Uid="ShortcutWarningLabel"/>
<Run Text="Win, Ctrl, Alt, Shift"/>
</TextBlock>
</controls:Setting.Description>
<controls:Setting.ActionContent>
<controls:HotkeySettingsControl HotkeySettings="{x:Bind Path=ViewModel.OpenShortcutGuide, Mode=TwoWay}"
Keys="Win, Ctrl, Alt, Shift"
<controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.OpenShortcutGuide, Mode=TwoWay}"
MinWidth="{StaticResource SettingActionControlMinWidth}"/>
</controls:Setting.ActionContent>
</controls:Setting>

View File

@ -24,43 +24,22 @@
<controls:SettingsGroup x:Uid="VideoConference_Shortcuts" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
<controls:Setting x:Uid="VideoConference_CameraAndMicrophoneMuteHotkeyControl_Header">
<controls:Setting.Description>
<TextBlock>
<Run x:Uid="ShortcutWarningLabel"/>
<Run Text="Win, Ctrl, Alt, Shift"/>
</TextBlock>
</controls:Setting.Description>
<controls:Setting.ActionContent>
<controls:HotkeySettingsControl HotkeySettings="{x:Bind Path=ViewModel.CameraAndMicrophoneMuteHotkey, Mode=TwoWay}"
Keys="Win, Ctrl, Alt, Shift"
<controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.CameraAndMicrophoneMuteHotkey, Mode=TwoWay}"
MinWidth="{StaticResource SettingActionControlMinWidth}"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="VideoConference_MicrophoneMuteHotkeyControl_Header">
<controls:Setting.Description>
<TextBlock>
<Run x:Uid="ShortcutWarningLabel"/>
<Run Text="Win, Ctrl, Alt, Shift"/>
</TextBlock>
</controls:Setting.Description>
<controls:Setting.ActionContent>
<controls:HotkeySettingsControl HotkeySettings="{x:Bind Path=ViewModel.MicrophoneMuteHotkey, Mode=TwoWay}"
Keys="Win, Ctrl, Alt, Shift"
<controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.MicrophoneMuteHotkey, Mode=TwoWay}"
MinWidth="{StaticResource SettingActionControlMinWidth}"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="VideoConference_CameraMuteHotkeyControl_Header">
<controls:Setting.Description>
<TextBlock>
<Run x:Uid="ShortcutWarningLabel"/>
<Run Text="Win, Ctrl, Alt, Shift"/>
</TextBlock>
</controls:Setting.Description>
<controls:Setting.ActionContent>
<controls:HotkeySettingsControl HotkeySettings="{x:Bind Path=ViewModel.CameraMuteHotkey, Mode=TwoWay}"
Keys="Win, Ctrl, Alt, Shift"
<controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.CameraMuteHotkey, Mode=TwoWay}"
MinWidth="{StaticResource SettingActionControlMinWidth}"/>
</controls:Setting.ActionContent>
</controls:Setting>