Skip to content

Conversation

@niels9001
Copy link
Collaborator

@niels9001 niels9001 commented Feb 11, 2026

Summary of the Pull Request

@jiripolasek FYI

This PR creates a new Common.UI.Controls library that contains shared WinUI controls. We have been copying code manually between CmdPal and Settings, and now with the new KBM we will run into the same issue.

This lib has shared controls projects can add to their proj so we have a single source of truth.

PR Checklist

  • 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
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@github-actions

This comment has been minimized.

@jiripolasek
Copy link
Collaborator

Nice! And I think this will take care of some gremlins in the system, like #45388

@jiripolasek
Copy link
Collaborator

Common.UI.Controls.csproj should be included in https://github.com/microsoft/PowerToys/blob/main/src/modules/cmdpal/CommandPalette.slnf

@niels9001 niels9001 marked this pull request as ready for review February 11, 2026 22:01
@niels9001 niels9001 requested a review from Copilot February 11, 2026 22:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request creates a new Common.UI.Controls library to consolidate shared WinUI controls that were previously duplicated between the Settings UI and CmdPal (Command Palette) modules. The PR addresses issue #45388 related to shortcut selection UI components by establishing a single source of truth for common controls, preventing future duplication as new modules like the Keyboard Manager are developed.

Changes:

  • Created Common.UI.Controls library with shared controls: KeyVisual, IsEnabledTextBlock, CheckBoxWithDescriptionControl, ShortcutWithTextLabelControl, and BoolToKeyVisualStateConverter
  • Updated Settings UI and CmdPal to reference the new shared library instead of maintaining duplicate implementations
  • Migrated all XAML namespace references from local control namespaces to Microsoft.PowerToys.Common.UI.Controls

Reviewed changes

Copilot reviewed 60 out of 60 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/common/Common.UI.Controls/Common.UI.Controls.csproj New project file for shared controls library with WinUI dependencies
src/common/Common.UI.Controls/Controls/* Moved control implementations (KeyVisual, IsEnabledTextBlock, CheckBoxWithDescriptionControl, ShortcutWithTextLabelControl) with namespace updates
src/common/Common.UI.Controls/Converters/BoolToKeyVisualStateConverter.cs Moved converter with namespace updated to Common.UI.Controls
src/common/Common.UI.Controls/Themes/Generic.xaml Resource dictionary merging all control styles
src/settings-ui/Settings.UI/SettingsXAML/Views/*.xaml Updated 11 view files to use ptcontrols namespace for shared controls
src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/*.xaml Updated 11 OOBE view files with new namespace references
src/settings-ui/Settings.UI/SettingsXAML/Controls/*.xaml Updated ShortcutControl components with new namespace and resource paths
src/settings-ui/Settings.UI/SettingsXAML/App.xaml Updated resource dictionary paths to reference Common.UI.Controls library
src/settings-ui/Settings.UI/SettingsXAML/Themes/Generic.xaml Removed IsEnabledTextBlock resource (now in shared library)
src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock.xaml Deleted (moved to shared library)
src/settings-ui/Settings.UI/PowerToys.Settings.csproj Added project reference to Common.UI.Controls, removed old resource references
src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/*.xaml Updated settings pages with new namespace references
src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/*.xaml Updated ShortcutControl with new namespace, visual states, and styling
src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutControl.xaml.cs Enhanced with SetKeys() method and visual state management
src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/*.cs Deleted duplicate control implementations
src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml Updated resource dictionary references to shared library
src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj Added project reference to Common.UI.Controls
src/modules/cmdpal/CommandPalette.slnf Added Common.UI.Controls project to solution filter
PowerToys.slnx Added Common.UI.Controls project to main solution
.github/actions/spell-check/expect.txt Added "ptcontrols" to spell-check dictionary

Comment on lines +405 to +415
private void C_ResetClick(object sender, RoutedEventArgs e)
{
hotkeySettings = null;

SetValue(HotkeySettingsProperty, hotkeySettings);
SetKeys();

lastValidSettings = hotkeySettings;
shortcutDialog.Hide();
}

Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method C_ResetClick is never called or wired up in the codebase. It appears to be dead code that duplicates the functionality of ShortcutDialog_Reset (line 430-438). Consider removing this unused method.

Suggested change
private void C_ResetClick(object sender, RoutedEventArgs e)
{
hotkeySettings = null;
SetValue(HotkeySettingsProperty, hotkeySettings);
SetKeys();
lastValidSettings = hotkeySettings;
shortcutDialog.Hide();
}

Copilot uses AI. Check for mistakes.
@jiripolasek
Copy link
Collaborator

Oh, squirrel ... preprocessor! That's my reward for cutting shortcuts

@jiripolasek
Copy link
Collaborator

jiripolasek commented Feb 12, 2026

@niels9001

Project Common.UI has base namespace Common.UI
Project Common.UI.Controls has base namespace Microsoft.PowerToys.Common.UI.Controls

That's a magnet for conflicts, like this b0a1acf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CmdPal: Shortcut selection gremlins

2 participants