From 798564eea499409126c2373bfb79a4f1fdb9afad Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Tue, 3 Mar 2026 10:54:28 +0100 Subject: [PATCH] CmdPal Dock visual bugfixes (#45871) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes the following bugs and iprovements: - The scroll forward/backward glyphs were clipped - The `Show labels` settings is redundant as those can be set individually, and actually messes with that setting. Therefore, removed from the Settings UI. - Minor string changes - The 'Filter commands' box is hidden when right clicking the Dock to customize it. --------- Co-authored-by: Jiří Polášek --- .../Controls/ContextMenu.xaml | 11 + .../Controls/ContextMenu.xaml.cs | 9 + .../Controls/ScrollContainer.xaml | 17 +- .../Dock/DockContentControl.xaml | 138 ++++++++ .../Dock/DockContentControl.xaml.cs | 103 ++++++ .../Microsoft.CmdPal.UI/Dock/DockControl.xaml | 327 ++++++------------ .../Dock/DockControl.xaml.cs | 21 +- .../Settings/DockSettingsPage.xaml | 21 +- .../Strings/en-us/Resources.resw | 7 +- 9 files changed, 403 insertions(+), 251 deletions(-) create mode 100644 src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockContentControl.xaml create mode 100644 src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockContentControl.xaml.cs diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml index d02c5bcbdb..5035016117 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml @@ -161,6 +161,17 @@ Style="{StaticResource SearchTextBoxStyle}" TextChanged="ContextFilterBox_TextChanged" /> + + + + + + + + + + + diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml.cs index 561470e15a..29839eb514 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml.cs @@ -23,6 +23,15 @@ public sealed partial class ContextMenu : UserControl, IRecipient, IRecipient { + public static readonly DependencyProperty ShowFilterBoxProperty = + DependencyProperty.Register(nameof(ShowFilterBox), typeof(bool), typeof(ContextMenu), new PropertyMetadata(true)); + + public bool ShowFilterBox + { + get => (bool)GetValue(ShowFilterBoxProperty); + set => SetValue(ShowFilterBoxProperty, value); + } + public ContextMenuViewModel ViewModel { get; } public ContextMenu() diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ScrollContainer.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ScrollContainer.xaml index ef1e65a01f..f8e594454f 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ScrollContainer.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ScrollContainer.xaml @@ -15,7 +15,8 @@ - + + @@ -154,7 +155,7 @@ @@ -192,14 +193,14 @@ - + - + @@ -227,7 +228,7 @@ - + diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockContentControl.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockContentControl.xaml new file mode 100644 index 0000000000..dcb1ba5dd9 --- /dev/null +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockContentControl.xaml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockContentControl.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockContentControl.xaml.cs new file mode 100644 index 0000000000..f2ce0c71cf --- /dev/null +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockContentControl.xaml.cs @@ -0,0 +1,103 @@ +// 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 Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; + +namespace Microsoft.CmdPal.UI.Dock; + +/// +/// A control that arranges Start, Center, and End sections in a dock layout +/// with built-in ScrollContainers. When is false, +/// the center is collapsed, the start section stretches, and the end section +/// auto-sizes. Supports horizontal/vertical orientation and edit mode styling. +/// +public sealed partial class DockContentControl : UserControl +{ + public static readonly DependencyProperty OrientationProperty = + DependencyProperty.Register(nameof(Orientation), typeof(Orientation), typeof(DockContentControl), new PropertyMetadata(Orientation.Horizontal)); + + public Orientation Orientation + { + get => (Orientation)GetValue(OrientationProperty); + set => SetValue(OrientationProperty, value); + } + + public static readonly DependencyProperty IsCenterVisibleProperty = + DependencyProperty.Register(nameof(IsCenterVisible), typeof(bool), typeof(DockContentControl), new PropertyMetadata(true)); + + public bool IsCenterVisible + { + get => (bool)GetValue(IsCenterVisibleProperty); + set => SetValue(IsCenterVisibleProperty, value); + } + + public static readonly DependencyProperty IsEditModeProperty = + DependencyProperty.Register(nameof(IsEditMode), typeof(bool), typeof(DockContentControl), new PropertyMetadata(false)); + + public bool IsEditMode + { + get => (bool)GetValue(IsEditModeProperty); + set => SetValue(IsEditModeProperty, value); + } + + public static readonly DependencyProperty StartSourceProperty = + DependencyProperty.Register(nameof(StartSource), typeof(object), typeof(DockContentControl), new PropertyMetadata(null)); + + public object StartSource + { + get => GetValue(StartSourceProperty); + set => SetValue(StartSourceProperty, value); + } + + public static readonly DependencyProperty StartActionButtonProperty = + DependencyProperty.Register(nameof(StartActionButton), typeof(object), typeof(DockContentControl), new PropertyMetadata(null)); + + public object StartActionButton + { + get => GetValue(StartActionButtonProperty); + set => SetValue(StartActionButtonProperty, value); + } + + public static readonly DependencyProperty CenterSourceProperty = + DependencyProperty.Register(nameof(CenterSource), typeof(object), typeof(DockContentControl), new PropertyMetadata(null)); + + public object CenterSource + { + get => GetValue(CenterSourceProperty); + set => SetValue(CenterSourceProperty, value); + } + + public static readonly DependencyProperty CenterActionButtonProperty = + DependencyProperty.Register(nameof(CenterActionButton), typeof(object), typeof(DockContentControl), new PropertyMetadata(null)); + + public object CenterActionButton + { + get => GetValue(CenterActionButtonProperty); + set => SetValue(CenterActionButtonProperty, value); + } + + public static readonly DependencyProperty EndSourceProperty = + DependencyProperty.Register(nameof(EndSource), typeof(object), typeof(DockContentControl), new PropertyMetadata(null)); + + public object EndSource + { + get => GetValue(EndSourceProperty); + set => SetValue(EndSourceProperty, value); + } + + public static readonly DependencyProperty EndActionButtonProperty = + DependencyProperty.Register(nameof(EndActionButton), typeof(object), typeof(DockContentControl), new PropertyMetadata(null)); + + public object EndActionButton + { + get => GetValue(EndActionButtonProperty); + set => SetValue(EndActionButtonProperty, value); + } + + public DockContentControl() + { + this.InitializeComponent(); + } +} diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockControl.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockControl.xaml index 738ee5f05f..ccfbbc8a22 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockControl.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockControl.xaml @@ -184,159 +184,122 @@ x:Name="RootGrid" BorderThickness="0,0,0,1" RightTapped="RootGrid_RightTapped"> - - + - - - - - - - - - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + Click="DoneEditingButton_Click" + Content="Save" + Style="{StaticResource AccentButtonStyle}" /> - - - - - - - - - - - - - - - - - - - - - - -