Skip to content
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

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions WinUIGallery/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<ResourceDictionary Source="/Styles/Grid.xaml" />
<ResourceDictionary Source="/Styles/GridViewItem.xaml" />
<ResourceDictionary Source="/Styles/TextBlock.xaml" />
<ResourceDictionary Source="/Styles/TitleBar.xaml" />
<ResourceDictionary Source="/Samples/ControlPages/Fundamentals/Controls/CounterControl.xaml" />
<ResourceDictionary Source="/Samples/ControlPages/Fundamentals/Controls/ValidatedPasswordBox.xaml" />
</ResourceDictionary.MergedDictionaries>
Expand Down
1 change: 0 additions & 1 deletion WinUIGallery/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ sealed partial class App : Application
{
internal static MainWindow MainWindow { get; private set; } = null!;

private static Win32WindowHelper win32WindowHelper;
private static int registeredKeyPressedHook = 0;
private HookProc keyEventHook;

Expand Down
3 changes: 2 additions & 1 deletion WinUIGallery/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
IsBackButtonVisible="{x:Bind rootFrame.CanGoBack, Mode=OneWay}"
IsPaneToggleButtonVisible="True"
PaneToggleRequested="TitleBar_PaneToggleRequested"
Style="{StaticResource StretchableContentTitleBarStyle}"
Subtitle="Dev">
<TitleBar.IconSource>
<ImageIconSource ImageSource="/Assets/Tiles/GalleryIcon.ico" />
</TitleBar.IconSource>
<TitleBar.CenterContent>
Copy link
Contributor

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.

Copy link
Contributor Author

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..

<AutoSuggestBox
x:Name="controlsSearchBox"
Width="480"
MaxWidth="480"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
x:FieldModifier="public"
Expand Down
39 changes: 19 additions & 20 deletions WinUIGallery/Pages/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,6 @@

<!-- This grid acts as a root panel for the page. -->
<Grid>
<VisualStateManager.VisualStateGroups>
<!-- Visual states reflect the application's window size -->
<VisualStateGroup x:Name="LayoutVisualStates">
<VisualState x:Name="WideLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource Breakpoint640Plus}" />
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="learnMoreGrid.Margin" Value="16,36,0,36" />
<Setter Target="itemGridView.Padding" Value="4,0,4,36" />
<Setter Target="itemGridView.ItemContainerStyle" Value="{StaticResource IndentedGridViewItemStyleSmall}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<GridView
x:Name="itemGridView"
Padding="24,0,24,0"
Expand Down Expand Up @@ -106,5 +86,24 @@
</GroupStyle>
</GridView.GroupStyle>
</GridView>
<VisualStateManager.VisualStateGroups>
<!-- Visual states reflect the application's window size -->
<VisualStateGroup x:Name="LayoutVisualStates">
<VisualState x:Name="WideLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource Breakpoint640Plus}" />
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="itemGridView.Padding" Value="4,0,4,36" />
<Setter Target="itemGridView.ItemContainerStyle" Value="{StaticResource IndentedGridViewItemStyleSmall}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</local:ItemsPageBase>
Loading