diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/DevRibbon.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/DevRibbon.xaml
index a4aa923f1b..e63e412ccf 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/DevRibbon.xaml
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/DevRibbon.xaml
@@ -206,9 +206,10 @@
-
+
-
+
+
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs
index 76d85794ba..a6900773ab 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs
@@ -54,6 +54,7 @@ public sealed partial class MainWindow : WindowEx,
IRecipient,
IRecipient,
IRecipient,
+ IRecipient,
IDisposable,
IHostWindow
{
@@ -91,6 +92,8 @@ public sealed partial class MainWindow : WindowEx,
private bool _preventHideWhenDeactivated;
+ private DevRibbon? _devRibbon;
+
private MainWindowViewModel ViewModel { get; }
public bool IsVisibleToUser { get; private set; } = true;
@@ -139,6 +142,7 @@ public sealed partial class MainWindow : WindowEx,
WeakReferenceMessenger.Default.Register(this);
WeakReferenceMessenger.Default.Register(this);
WeakReferenceMessenger.Default.Register(this);
+ WeakReferenceMessenger.Default.Register(this);
// Hide our titlebar.
// We need to both ExtendsContentIntoTitleBar, then set the height to Collapsed
@@ -212,7 +216,8 @@ public sealed partial class MainWindow : WindowEx,
// Add dev ribbon if enabled
if (!BuildInfo.IsCiBuild)
{
- RootElement.Children.Add(new DevRibbon { Margin = new Thickness(-1, -1, 120, -1) });
+ _devRibbon = new DevRibbon { Margin = new Thickness(-1, -1, 120, -1) };
+ RootElement.Children.Add(_devRibbon);
}
}
@@ -1134,6 +1139,11 @@ public sealed partial class MainWindow : WindowEx,
DisposeAcrylic();
}
+ public void Receive(ToggleDevRibbonMessage message)
+ {
+ _devRibbon?.Visibility = _devRibbon.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
+ }
+
public void Receive(DragStartedMessage message)
{
_preventHideWhenDeactivated = true;
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Messages/ToggleDevRibbonMessage.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Messages/ToggleDevRibbonMessage.cs
new file mode 100644
index 0000000000..deb5aecc2b
--- /dev/null
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Messages/ToggleDevRibbonMessage.cs
@@ -0,0 +1,7 @@
+// 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.
+
+namespace Microsoft.CmdPal.UI.Messages;
+
+public record ToggleDevRibbonMessage;
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/InternalPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/InternalPage.xaml
index 4cf878ec44..bfb3768db6 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/InternalPage.xaml
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/InternalPage.xaml
@@ -57,6 +57,13 @@
HeaderIcon="{ui:FontIcon Glyph=}">
+
+
+
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/InternalPage.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/InternalPage.xaml.cs
index a797a6a25d..627f3c5574 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/InternalPage.xaml.cs
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/InternalPage.xaml.cs
@@ -2,8 +2,11 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using CommunityToolkit.Mvvm.Messaging;
using ManagedCommon;
using Microsoft.CmdPal.Core.Common.Services;
+using Microsoft.CmdPal.UI.Messages;
+using Microsoft.CommandPalette.Extensions.Toolkit;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
using Windows.System;
@@ -94,4 +97,9 @@ public sealed partial class InternalPage : Page
Logger.LogError("Failed to open directory in Explorer", ex);
}
}
+
+ private void ToggleDevRibbonClicked(object sender, RoutedEventArgs e)
+ {
+ WeakReferenceMessenger.Default.Send(new ToggleDevRibbonMessage());
+ }
}
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/ViewModels/DevRibbonViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/ViewModels/DevRibbonViewModel.cs
index 679d7e4108..aa77772f11 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/ViewModels/DevRibbonViewModel.cs
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/ViewModels/DevRibbonViewModel.cs
@@ -107,6 +107,12 @@ internal sealed partial class DevRibbonViewModel : ObservableObject
WeakReferenceMessenger.Default.Send(new OpenSettingsMessage("Internal"));
}
+ [RelayCommand]
+ private void ToggleDevRibbonVisibility()
+ {
+ WeakReferenceMessenger.Default.Send(new ToggleDevRibbonMessage());
+ }
+
private sealed partial class DevRibbonTraceListener(DevRibbonViewModel viewModel) : TraceListener
{
private const string TimestampFormat = "yyyy-MM-dd HH:mm:ss.fff";