-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT] MainWindow.xaml with new TitleBar + TitleBar samples #1797
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR introduces a new MainWindow.xaml and refactors navigation and titlebar logic to follow design best practices for Windows 11. It also removes unused code and makes the copy link logic dynamic based on build configuration.
- Migrates navigation calls from NavigationRootPage to App.MainWindow.
- Updates version and theme parsing to use the new helper classes.
- Adjusts URI schemes for protocol activation based on debug/release mode.
Reviewed Changes
File | Description |
---|---|
WinUIGallery/Helpers/VersionHelper.cs | Adds version details properties and retrieves Windows App Runtime version dynamically. |
WinUIGallery/Helpers/EnumHelper.cs | Provides a generic enum parsing helper to replace custom implementations. |
WinUIGallery/App.xaml.cs | Refactors window initialization and navigation to use MainWindow instead of a separate NavigationRootPage. |
WinUIGallery/Helpers/ProtocolActivationClipboardHelper.cs | Makes copy link logic dynamic by selecting the appropriate URI scheme. |
WinUIGallery/Pages/* | Updates various page navigations to reference the new MainWindow navigation APIs. |
WinUIGallery/MainWindow.xaml.cs | Consolidates navigation, titlebar, and window management logic into MainWindow. |
WinUIGallery/Helpers/NavigationOrientationHelper.cs, ThemeHelper.cs, TitleBarHelper.cs | Adjusts helper methods to align with changes in window and navigation handling. |
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that the TitleBar sample
should also be updated in the same PR to describe the new TitleBar
.
For me, I have issues with restoring a number of packages. Is there an issue with dev.azure.com? |
Maybe better to that in a separate PR? I've created an tracking issue here: #1798 |
<TitleBar.IconSource> | ||
<ImageIconSource ImageSource="/Assets/Tiles/GalleryIcon.ico" /> | ||
</TitleBar.IconSource> | ||
<TitleBar.CenterContent> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @niels9001
The API names have been officially updated to LeftHeader, Content, and RightHeader.
microsoft/microsoft-ui-xaml#10056 (comment)
Therefore, <TitleBar.CenterContent>
should be changed to <TitleBar.Content>
to reflect these updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but those changes aren't part of Preview1 that I'm using in this PR..
@Zakariathr22 Since some of that old sample code was intertwined with the Gallery itself, I've created the new samples for |
BorderBrush="{ThemeResource SurfaceStrokeColorDefaultBrush}" | ||
BorderThickness="1" | ||
CornerRadius="{StaticResource OverlayCornerRadius}"> | ||
<TitleBar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should showcase TitleBar.LeftContent as well, so developers can see all the available customization options for the TitleBar
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about that, but couldn't come up with a good use case really.. since the other content is RightContent
I figured it's fine to show one of the two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of adding something like a refresh button?
<TitleBar.LeftContent>
<Border>
<Border.Resources>
<Style x:Key="TitleBarButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Margin" Value="2" />
<Setter Property="Padding" Value="12,0" />
<Setter Property="CornerRadius" Value="4" />
</Style>
</Border.Resources>
<Button Style="{StaticResource TitleBarButtonStyle}">
<FontIcon Glyph="" FontSize="14"/>
<ToolTipService.ToolTip>
Refresh
</ToolTipService.ToolTip>
</Button>
</Border>
</TitleBar.LeftContent>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of adding something like a refresh button?
<TitleBar.LeftContent> <Border> <Border.Resources> <Style x:Key="TitleBarButtonStyle" TargetType="Button"> <Setter Property="Background" Value="Transparent" /> <Setter Property="VerticalAlignment" Value="Stretch" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Margin" Value="2" /> <Setter Property="Padding" Value="12,0" /> <Setter Property="CornerRadius" Value="4" /> </Style> </Border.Resources> <Button Style="{StaticResource TitleBarButtonStyle}"> <FontIcon Glyph="" FontSize="14"/> <ToolTipService.ToolTip> Refresh </ToolTipService.ToolTip> </Button> </Border> </TitleBar.LeftContent>
How about adding a theme toggle button?
Or even better, display current user profile (PersonPicture)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a theme toggle button?
Or even better, display current user profile (PersonPicture)
Do you mean adding it to the TitleBar
sample example or the app's title bar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a theme toggle button?
Or even better, display current user profile (PersonPicture)Do you mean adding it to the
TitleBar
sample example or the app's title bar?
I dont know, mybe, current user can be added in titlebar sample and theme toggle button in apps titlebar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to have something that is not a button, so it stands out a bit more compared to the back and panetoggle buttons (as those come with the control by default).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to have something that is not a button, so it stands out a bit more compared to the back and panetoggle buttons (as those come with the control by default).
What about online/offline status?
<TitleBar.LeftContent>
<FontIcon Glyph="" Foreground="{ThemeResource SystemFillColorSuccessBrush}"
FontSize="14" Margin="12,0">
<ToolTipService.ToolTip>
Online
</ToolTipService.ToolTip>
</FontIcon>
</TitleBar.LeftContent>
Co-authored-by: Zakaria Tahri | Shade <[email protected]>
Co-authored-by: Zakaria Tahri | Shade <[email protected]>
DO NOT MERGE UNTIL WASDK 1.7 STABLE
Closes: #1736 #1798
Changes:
MainWindow.xaml
in favor of creating a window in code-behind +NavigationRootPage
.TitleBar
control: moving the pane toggle button and searchbox to theTitleBar
following design best practices for Windows 11