Skip to content

Commit 1dddf9f

Browse files
niels9001lei9444
andauthored
"What's new" improvements (#44638)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request TO DO: Upgrade to the latest version of MarkdownTextBlock: CommunityToolkit/Labs-Windows#771 This PR introduces the following changes: **Removed the custom titlebars on the OOBE Window, and replaced it with the inbox WinUI `TitleBar` control.** **New "What's new" experience following the VS Code release notes experience** - Created a new SCOOBE Windows that is a standalone window to better visualize release notes. - Adding a nav menu on the left to easily switch between release notes, instead of a long page. - Point releases are combined with the latest main release.. e.g. 0.96.1 is rendered above 0.96.0. - The 'hero image' on main release notes will automatically be rendered at the top of the page. - Improved markdown styling for better readability. - Pull requests links can now be clicked. - Upgraded `CommunityToolkit.Labs.MarkdownTextblock` to the latest version as it includes much needed bugfixes. <img width="1234" height="819" alt="image" src="https://github.com/user-attachments/assets/447b3136-306b-4f24-bc7a-c022a99e8e51" /> Note: the blurry image shown above will be replaced in new releases by an image that fits the right dimensions. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **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 <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed --------- Co-authored-by: Leilei Zhang <[email protected]>
1 parent 0d59b9f commit 1dddf9f

18 files changed

+808
-677
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PackageVersion Include="CommunityToolkit.WinUI.Converters" Version="8.2.250402" />
2727
<PackageVersion Include="CommunityToolkit.WinUI.Extensions" Version="8.2.250402" />
2828
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" />
29-
<PackageVersion Include="CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock" Version="0.1.251002-build.2316" />
29+
<PackageVersion Include="CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock" Version="0.1.260107-build.2454" />
3030
<PackageVersion Include="ControlzEx" Version="6.0.0" />
3131
<PackageVersion Include="HelixToolkit" Version="2.24.0" />
3232
<PackageVersion Include="HelixToolkit.Core.Wpf" Version="2.24.0" />

src/settings-ui/Settings.UI/OOBE/Enums/PowerToysModules.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public enum PowerToysModules
3232
MeasureTool,
3333
Hosts,
3434
Workspaces,
35-
WhatsNew,
3635
RegistryPreview,
3736
NewPlus,
3837
ZoomIt,

src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using System.Linq;
1010
using System.Text.Json;
1111
using System.Threading.Tasks;
12-
1312
using ManagedCommon;
1413
using Microsoft.PowerToys.Settings.UI.Helpers;
1514
using Microsoft.PowerToys.Settings.UI.Library;
@@ -227,7 +226,6 @@ private void OnLaunchedFromRunner(string[] cmdArgs)
227226
{
228227
settingsWindow = new MainWindow();
229228
settingsWindow.Activate();
230-
settingsWindow.ExtendsContentIntoTitleBar = true;
231229
settingsWindow.NavigateToSection(StartupPage);
232230

233231
// https://github.com/microsoft/microsoft-ui-xaml/issues/7595 - Activate doesn't bring window to the foreground
@@ -257,11 +255,10 @@ private void OnLaunchedFromRunner(string[] cmdArgs)
257255
else if (ShowScoobe)
258256
{
259257
PowerToysTelemetry.Log.WriteEvent(new ScoobeStartedEvent());
260-
OobeWindow scoobeWindow = new OobeWindow(OOBE.Enums.PowerToysModules.WhatsNew);
261-
scoobeWindow.Activate();
262-
scoobeWindow.ExtendsContentIntoTitleBar = true;
258+
ScoobeWindow newScoobeWindow = new ScoobeWindow();
259+
newScoobeWindow.Activate();
263260
WindowHelpers.ForceTopBorder1PixelInsetOnWindows10(WindowNative.GetWindowHandle(settingsWindow));
264-
SetOobeWindow(scoobeWindow);
261+
SetScoobeWindow(newScoobeWindow);
265262
}
266263
}
267264
}
@@ -339,6 +336,7 @@ public static int UpdateUIThemeMethod(string themeName)
339336

340337
private static MainWindow settingsWindow;
341338
private static OobeWindow oobeWindow;
339+
private static ScoobeWindow scoobeWindow;
342340

343341
public static void ClearSettingsWindow()
344342
{
@@ -365,6 +363,21 @@ public static void ClearOobeWindow()
365363
oobeWindow = null;
366364
}
367365

366+
public static ScoobeWindow GetScoobeWindow()
367+
{
368+
return scoobeWindow;
369+
}
370+
371+
public static void SetScoobeWindow(ScoobeWindow window)
372+
{
373+
scoobeWindow = window;
374+
}
375+
376+
public static void ClearScoobeWindow()
377+
{
378+
scoobeWindow = null;
379+
}
380+
368381
public static Type GetPage(string settingWindow)
369382
{
370383
switch (settingWindow)

src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
namespace Microsoft.PowerToys.Settings.UI
2222
{
23-
/// <summary>
24-
/// An empty window that can be used on its own or navigated to within a Frame.
25-
/// </summary>
2623
public sealed partial class MainWindow : WindowEx
2724
{
2825
public MainWindow(bool createHidden = false)
@@ -35,10 +32,12 @@ public MainWindow(bool createHidden = false)
3532
App.ThemeService.ThemeChanged += OnThemeChanged;
3633
App.ThemeService.ApplyTheme();
3734

35+
this.ExtendsContentIntoTitleBar = true;
36+
3837
ShellPage.SetElevationStatus(App.IsElevated);
3938
ShellPage.SetIsUserAnAdmin(App.IsUserAnAdmin);
4039

41-
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
40+
var hWnd = WindowNative.GetWindowHandle(this);
4241
var placement = WindowHelper.DeserializePlacementOrDefault(hWnd);
4342
if (createHidden)
4443
{
@@ -121,16 +120,12 @@ public MainWindow(bool createHidden = false)
121120
// open whats new window
122121
ShellPage.SetOpenWhatIsNewCallback(() =>
123122
{
124-
if (App.GetOobeWindow() == null)
123+
if (App.GetScoobeWindow() == null)
125124
{
126-
App.SetOobeWindow(new OobeWindow(OOBE.Enums.PowerToysModules.WhatsNew));
127-
}
128-
else
129-
{
130-
App.GetOobeWindow().SetAppWindow(OOBE.Enums.PowerToysModules.WhatsNew);
125+
App.SetScoobeWindow(new ScoobeWindow());
131126
}
132127

133-
App.GetOobeWindow().Activate();
128+
App.GetScoobeWindow().Activate();
134129
});
135130

136131
this.InitializeComponent();
@@ -187,7 +182,7 @@ private void Window_Closed(object sender, WindowEventArgs args)
187182
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
188183
WindowHelper.SerializePlacement(hWnd);
189184

190-
if (App.GetOobeWindow() == null)
185+
if (App.GetOobeWindow() == null && App.GetScoobeWindow() == null)
191186
{
192187
App.ClearSettingsWindow();
193188
}

src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShellPage.xaml

Lines changed: 21 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,44 @@
1-
<UserControl
1+
<Page
22
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeShellPage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:animations="using:CommunityToolkit.WinUI.Animations"
65
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
76
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
87
xmlns:ui="using:CommunityToolkit.WinUI"
98
HighContrastAdjustment="None"
109
Loaded="ShellPage_Loaded"
1110
mc:Ignorable="d">
12-
1311
<Grid>
1412
<Grid.RowDefinitions>
15-
<RowDefinition Height="Auto" />
13+
<RowDefinition Height="48" />
1614
<RowDefinition Height="*" />
1715
</Grid.RowDefinitions>
18-
<Button
19-
x:Name="PaneToggleBtn"
20-
Width="48"
21-
HorizontalAlignment="Left"
22-
VerticalAlignment="Center"
23-
Click="PaneToggleBtn_Click"
24-
Style="{StaticResource PaneToggleButtonStyle}" />
25-
<Grid
16+
<TitleBar
2617
x:Name="AppTitleBar"
27-
Height="48"
28-
Margin="48,0,0,0"
29-
VerticalAlignment="Center"
30-
IsHitTestVisible="True">
31-
<animations:Implicit.Animations>
32-
<animations:OffsetAnimation Duration="0:0:0.3" />
33-
</animations:Implicit.Animations>
34-
<StackPanel Orientation="Horizontal">
35-
<Image
36-
Width="16"
18+
x:Uid="OobeWindow_TitleTxt"
19+
IsBackButtonVisible="False"
20+
IsPaneToggleButtonVisible="False"
21+
PaneToggleRequested="TitleBar_PaneButtonClick">
22+
<!-- This is a workaround for https://github.com/microsoft/microsoft-ui-xaml/issues/10374, once fixed we should just be using IconSource -->
23+
<TitleBar.LeftHeader>
24+
<ImageIcon
25+
x:Name="TitleBarIcon"
3726
Height="16"
27+
Margin="16,0,0,0"
3828
Source="/Assets/Settings/icon.ico" />
39-
<TextBlock
40-
x:Name="AppTitleBarText"
41-
x:Uid="OobeWindow_TitleTxt"
42-
VerticalAlignment="Center"
43-
Style="{StaticResource CaptionTextBlockStyle}"
44-
TextWrapping="NoWrap" />
45-
</StackPanel>
46-
</Grid>
47-
29+
</TitleBar.LeftHeader>
30+
</TitleBar>
4831
<NavigationView
4932
x:Name="navigationView"
5033
Grid.Row="1"
34+
CompactModeThresholdWidth="1007"
5135
DisplayModeChanged="NavigationView_DisplayModeChanged"
36+
ExpandedModeThresholdWidth="1007"
5237
IsBackButtonVisible="Collapsed"
5338
IsPaneOpen="True"
5439
IsPaneToggleButtonVisible="False"
5540
IsSettingsVisible="False"
5641
OpenPaneLength="296"
57-
PaneDisplayMode="Left"
5842
SelectionChanged="NavigationView_SelectionChanged">
5943
<NavigationView.MenuItems>
6044
<NavigationViewItem
@@ -174,34 +158,16 @@
174158
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ZoomIt.png}"
175159
Tag="ZoomIt" />
176160
</NavigationView.MenuItems>
177-
<NavigationView.FooterMenuItems>
161+
<NavigationView.PaneFooter>
178162
<NavigationViewItem
179163
x:Uid="Shell_WhatsNew"
164+
AutomationProperties.AutomationId="WhatIsNewNavItem"
180165
Icon="{ui:FontIcon Glyph=&#xE789;}"
181-
Tag="WhatsNew" />
182-
</NavigationView.FooterMenuItems>
166+
Tapped="WhatIsNewItem_Tapped" />
167+
</NavigationView.PaneFooter>
183168
<NavigationView.Content>
184169
<Frame x:Name="NavigationFrame" />
185170
</NavigationView.Content>
186171
</NavigationView>
187-
188-
<VisualStateManager.VisualStateGroups>
189-
<VisualStateGroup x:Name="LayoutVisualStates">
190-
<VisualState x:Name="WideLayout">
191-
<VisualState.StateTriggers>
192-
<AdaptiveTrigger MinWindowWidth="720" />
193-
</VisualState.StateTriggers>
194-
</VisualState>
195-
<VisualState x:Name="SmallLayout">
196-
<VisualState.StateTriggers>
197-
<AdaptiveTrigger MinWindowWidth="600" />
198-
<AdaptiveTrigger MinWindowWidth="0" />
199-
</VisualState.StateTriggers>
200-
<VisualState.Setters>
201-
<Setter Target="navigationView.PaneDisplayMode" Value="LeftMinimal" />
202-
</VisualState.Setters>
203-
</VisualState>
204-
</VisualStateGroup>
205-
</VisualStateManager.VisualStateGroups>
206172
</Grid>
207-
</UserControl>
173+
</Page>

src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShellPage.xaml.cs

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
using System;
66
using System.Collections.ObjectModel;
77
using System.Globalization;
8-
98
using ManagedCommon;
109
using Microsoft.PowerToys.Settings.UI.Library;
1110
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
1211
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
1312
using Microsoft.UI.Xaml;
1413
using Microsoft.UI.Xaml.Controls;
15-
using WinRT.Interop;
14+
using Microsoft.UI.Xaml.Input;
1615

1716
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
1817
{
19-
public sealed partial class OobeShellPage : UserControl
18+
public sealed partial class OobeShellPage : Page
2019
{
2120
public static Func<string> RunSharedEventCallback { get; set; }
2221

@@ -63,7 +62,6 @@ public OobeShellPage()
6362

6463
// NOTE: Experimentation for OOBE is currently turned off on server side. Keeping this code in a comment to allow future experiments.
6564
// ExperimentationToggleSwitchEnabled = SettingsRepository<GeneralSettings>.GetInstance(settingsUtils).SettingsConfig.EnableExperimentation;
66-
SetTitleBar();
6765
DataContext = ViewModel;
6866
OobeShellHandler = this;
6967
Modules = new ObservableCollection<OobePowerToysModule>();
@@ -202,12 +200,6 @@ public OobeShellPage()
202200
IsNew = true,
203201
});
204202

205-
Modules.Insert((int)PowerToysModules.WhatsNew, new OobePowerToysModule()
206-
{
207-
ModuleName = "WhatsNew",
208-
IsNew = false,
209-
});
210-
211203
Modules.Insert((int)PowerToysModules.RegistryPreview, new OobePowerToysModule()
212204
{
213205
ModuleName = "RegistryPreview",
@@ -229,7 +221,7 @@ public OobeShellPage()
229221

230222
public void OnClosing()
231223
{
232-
Microsoft.UI.Xaml.Controls.NavigationViewItem selectedItem = this.navigationView.SelectedItem as Microsoft.UI.Xaml.Controls.NavigationViewItem;
224+
NavigationViewItem selectedItem = this.navigationView.SelectedItem as NavigationViewItem;
233225
if (selectedItem != null)
234226
{
235227
Modules[(int)(PowerToysModules)Enum.Parse(typeof(PowerToysModules), (string)selectedItem.Tag, true)].LogClosingModuleEvent();
@@ -238,19 +230,22 @@ public void OnClosing()
238230

239231
public void NavigateToModule(PowerToysModules selectedModule)
240232
{
241-
if (selectedModule == PowerToysModules.WhatsNew)
242-
{
243-
navigationView.SelectedItem = navigationView.FooterMenuItems[0];
244-
}
245-
else
233+
navigationView.SelectedItem = navigationView.MenuItems[(int)selectedModule];
234+
}
235+
236+
private static void OpenScoobeWindow()
237+
{
238+
if (App.GetScoobeWindow() == null)
246239
{
247-
navigationView.SelectedItem = navigationView.MenuItems[(int)selectedModule];
240+
App.SetScoobeWindow(new ScoobeWindow());
248241
}
242+
243+
App.GetScoobeWindow().Activate();
249244
}
250245

251-
private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args)
246+
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
252247
{
253-
Microsoft.UI.Xaml.Controls.NavigationViewItem selectedItem = args.SelectedItem as Microsoft.UI.Xaml.Controls.NavigationViewItem;
248+
NavigationViewItem selectedItem = args.SelectedItem as NavigationViewItem;
254249

255250
if (selectedItem != null)
256251
{
@@ -278,7 +273,7 @@ private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigati
278273
break;
279274
}
280275
*/
281-
case "WhatsNew": NavigationFrame.Navigate(typeof(OobeWhatsNew)); break;
276+
282277
case "AdvancedPaste": NavigationFrame.Navigate(typeof(OobeAdvancedPaste)); break;
283278
case "AlwaysOnTop": NavigationFrame.Navigate(typeof(OobeAlwaysOnTop)); break;
284279
case "Awake": NavigationFrame.Navigate(typeof(OobeAwake)); break;
@@ -311,43 +306,37 @@ private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigati
311306
}
312307
}
313308

314-
private void SetTitleBar()
315-
{
316-
var u = App.GetOobeWindow();
317-
if (u != null)
318-
{
319-
// A custom title bar is required for full window theme and Mica support.
320-
// https://docs.microsoft.com/windows/apps/develop/title-bar?tabs=winui3#full-customization
321-
u.ExtendsContentIntoTitleBar = true;
322-
WindowHelpers.ForceTopBorder1PixelInsetOnWindows10(WindowNative.GetWindowHandle(u));
323-
u.SetTitleBar(AppTitleBar);
324-
}
325-
}
326-
327309
private void ShellPage_Loaded(object sender, RoutedEventArgs e)
328310
{
329-
SetTitleBar();
311+
// Select the first module by default
312+
if (navigationView.MenuItems.Count > 0)
313+
{
314+
navigationView.SelectedItem = navigationView.MenuItems[0];
315+
}
330316
}
331317

332318
private void NavigationView_DisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)
333319
{
334320
if (args.DisplayMode == NavigationViewDisplayMode.Compact || args.DisplayMode == NavigationViewDisplayMode.Minimal)
335321
{
336-
PaneToggleBtn.Visibility = Visibility.Visible;
337-
AppTitleBar.Margin = new Thickness(48, 0, 0, 0);
338-
AppTitleBarText.Margin = new Thickness(12, 0, 0, 0);
322+
TitleBarIcon.Margin = new Thickness(0, 0, 8, 0); // Workaround, see XAML comment
323+
AppTitleBar.IsPaneToggleButtonVisible = true;
339324
}
340325
else
341326
{
342-
PaneToggleBtn.Visibility = Visibility.Collapsed;
343-
AppTitleBar.Margin = new Thickness(16, 0, 0, 0);
344-
AppTitleBarText.Margin = new Thickness(16, 0, 0, 0);
327+
TitleBarIcon.Margin = new Thickness(16, 0, 0, 0); // Workaround, see XAML comment
328+
AppTitleBar.IsPaneToggleButtonVisible = false;
345329
}
346330
}
347331

348-
private void PaneToggleBtn_Click(object sender, RoutedEventArgs e)
332+
private void TitleBar_PaneButtonClick(TitleBar sender, object args)
349333
{
350334
navigationView.IsPaneOpen = !navigationView.IsPaneOpen;
351335
}
336+
337+
private void WhatIsNewItem_Tapped(object sender, TappedRoutedEventArgs e)
338+
{
339+
OpenScoobeWindow();
340+
}
352341
}
353342
}

0 commit comments

Comments
 (0)