From 4070bc6e910443ce4fdfe60db891b4322d4dfdee Mon Sep 17 00:00:00 2001
From: Kai Tao <69313318+vanzue@users.noreply.github.com>
Date: Wed, 28 Jan 2026 10:37:22 +0800
Subject: [PATCH] [ZoomIt] Show users full hotkey list in settings (#43073)
## Summary of the Pull Request
This PR enhances the ZoomIt settings UI by refactoring some of the XAML
code and putting instructions as part of the settingsexpanders.
Additionally, the alternate hotkey combinations are now shown too and
will be updated based on the configured hotkey.
so that **Users will now be able to see all the hotkeys**.
## PR Checklist
- [x] Closes: #42236
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx
## Detailed Description of the Pull Request / Additional comments
## Validation Steps Performed
### ZoomIt Extended (Derived) Hotkeys
Feature | Base Key Property | Default Base Key | Derived Key Property |
XOR Logic | Default Derived Key | Description
-- | -- | -- | -- | -- | -- | --
LiveZoom | LiveZoomToggleKey | Ctrl+4 | LiveZoomToggleKeyDraw | XOR
Shift | Ctrl+Shift+4 | Enter drawing mode in LiveZoom
Record | RecordToggleKey | Ctrl+5 | RecordToggleKeyCrop | XOR Shift |
Ctrl+Shift+5 | Record selected region (crop)
Record | RecordToggleKey | Ctrl+5 | RecordToggleKeyWindow | XOR Alt |
Ctrl+Alt+5 | Record specific window
Snip | SnipToggleKey | Ctrl+6 | SnipToggleKeySave | XOR Shift |
Ctrl+Shift+6 | Snip and save to file
DemoType | DemoTypeToggleKey | Ctrl+7 | DemoTypeToggleKeyReset | XOR
Shift | Ctrl+Shift+7 | Rewind to previous segment
---------
Signed-off-by: check-spelling-bot
Co-authored-by: Niels Laute
Co-authored-by: Kai Tao
---
...otkeySettingsToLocalizedStringConverter.cs | 31 ++
.../ZoomItOpacitySliderConverter.cs | 24 +
.../Settings.UI/PowerToys.Settings.csproj | 3 +
.../Settings.UI/SettingsXAML/App.xaml | 6 +-
.../ShortcutWithTextLabelControl.xaml | 119 ++---
.../ShortcutWithTextLabelControl.xaml.cs | 49 ++-
.../SettingsXAML/Views/ZoomItPage.xaml | 416 ++++++++++--------
.../Settings.UI/Strings/en-us/Resources.resw | 150 ++++---
.../Settings.UI/ViewModels/ZoomItViewModel.cs | 181 +++++++-
9 files changed, 658 insertions(+), 321 deletions(-)
create mode 100644 src/settings-ui/Settings.UI/Converters/HotkeySettingsToLocalizedStringConverter.cs
create mode 100644 src/settings-ui/Settings.UI/Converters/ZoomItOpacitySliderConverter.cs
diff --git a/src/settings-ui/Settings.UI/Converters/HotkeySettingsToLocalizedStringConverter.cs b/src/settings-ui/Settings.UI/Converters/HotkeySettingsToLocalizedStringConverter.cs
new file mode 100644
index 0000000000..c092525c75
--- /dev/null
+++ b/src/settings-ui/Settings.UI/Converters/HotkeySettingsToLocalizedStringConverter.cs
@@ -0,0 +1,31 @@
+// 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.Windows;
+using Microsoft.PowerToys.Settings.UI.Helpers;
+using Microsoft.PowerToys.Settings.UI.Library;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.Windows.ApplicationModel.Resources;
+
+namespace Microsoft.PowerToys.Settings.UI.Converters
+{
+ public partial class HotkeySettingsToLocalizedStringConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ if (value is HotkeySettings keySettings && parameter is string resourceKey)
+ {
+ return string.Format(System.Globalization.CultureInfo.CurrentCulture, ResourceLoaderInstance.ResourceLoader.GetString(resourceKey), keySettings.ToString());
+ }
+
+ return string.Empty;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/settings-ui/Settings.UI/Converters/ZoomItOpacitySliderConverter.cs b/src/settings-ui/Settings.UI/Converters/ZoomItOpacitySliderConverter.cs
new file mode 100644
index 0000000000..e82211c886
--- /dev/null
+++ b/src/settings-ui/Settings.UI/Converters/ZoomItOpacitySliderConverter.cs
@@ -0,0 +1,24 @@
+// 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.UI.Xaml.Data;
+
+namespace Microsoft.PowerToys.Settings.UI.Converters
+{
+ public sealed partial class ZoomItOpacitySliderConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ // Slider value is 1-100, display as percentage
+ int percentage = System.Convert.ToInt32((double)value);
+ return $"{percentage}%";
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
index dcb0ef97ba..261ca48155 100644
--- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
+++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
@@ -176,6 +176,9 @@
Always
+
+ MSBuild:Compile
+ MSBuild:Compile
diff --git a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml
index f63ccdf3a6..54b1e1a02f 100644
--- a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml
+++ b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml
@@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
+ xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters">
@@ -18,7 +19,7 @@
-
+
@@ -81,9 +82,6 @@
-
-
-
diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml
index bc46c9d17e..719091a787 100644
--- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml
+++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml
@@ -1,58 +1,67 @@
-
+
+ xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
+ xmlns:tk="using:CommunityToolkit.WinUI"
+ xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs
index c3829e3984..7e4d31c28b 100644
--- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs
+++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs
@@ -1,15 +1,15 @@
-// Copyright (c) Microsoft Corporation
+// 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.Collections.Generic;
-
+using CommunityToolkit.WinUI.Controls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
- public sealed partial class ShortcutWithTextLabelControl : UserControl
+ public sealed partial class ShortcutWithTextLabelControl : Control
{
public string Text
{
@@ -27,26 +27,47 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
public static readonly DependencyProperty KeysProperty = DependencyProperty.Register(nameof(Keys), typeof(List