Skip to content

Commit 8d49097

Browse files
authored
Merge pull request #459 from CommunityToolkit/niels9001/titlebar-experiment
[Experiment] TitleBar
2 parents 9aa7bd1 + aa780a5 commit 8d49097

35 files changed

+2038
-0
lines changed

components/TitleBar/OpenSolution.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
3+
powershell ..\..\tooling\ProjectHeads\GenerateSingleSampleHeads.ps1 -componentPath %CD% %*
Loading
2.98 KB
Loading
6.05 KB
Loading
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!--
2+
WinUI 2 under UWP uses TargetFramework uap10.0.*
3+
WinUI 3 under WinAppSdk uses TargetFramework net6.0-windows10.*
4+
However, under Uno-powered platforms, both WinUI 2 and 3 can share the same TargetFramework.
5+
6+
MSBuild doesn't play nicely with this out of the box, so we've made it easy for you.
7+
8+
For .NET Standard packages, you can use the Nuget Package Manager in Visual Studio.
9+
For UWP / WinAppSDK / Uno packages, place the package references here.
10+
-->
11+
<Project>
12+
<!-- WinUI 2 / UWP -->
13+
<ItemGroup Condition="'$(IsUwp)' == 'true'">
14+
<!-- <PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.2"/> -->
15+
</ItemGroup>
16+
17+
<!-- WinUI 2 / Uno -->
18+
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '2'">
19+
<!-- <PackageReference Include="Uno.Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.11"/> -->
20+
</ItemGroup>
21+
22+
<!-- WinUI 3 / WinAppSdk -->
23+
<ItemGroup Condition="'$(IsWinAppSdk)' == 'true'">
24+
<!-- <PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.2"/> -->
25+
</ItemGroup>
26+
27+
<!-- WinUI 3 / Uno -->
28+
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '3'">
29+
<!-- <PackageReference Include="Uno.CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.100-dev.15.g12261e2626"/> -->
30+
</ItemGroup>
31+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Page x:Class="TitleBarExperiment.Samples.FirstPage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="using:TitleBarExperiment.Samples"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
9+
mc:Ignorable="d">
10+
11+
<Grid>
12+
<TextBlock HorizontalAlignment="Center"
13+
VerticalAlignment="Center"
14+
FontSize="48"
15+
FontWeight="SemiBold"
16+
Text="1" />
17+
</Grid>
18+
</Page>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace TitleBarExperiment.Samples;
6+
/// <summary>
7+
/// An empty page that can be used on its own or navigated to within a Frame.
8+
/// </summary>
9+
public sealed partial class FirstPage : Page
10+
{
11+
public FirstPage()
12+
{
13+
this.InitializeComponent();
14+
}
15+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Page x:Class="TitleBarExperiment.Samples.SecondPage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="using:TitleBarExperiment.Samples"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
9+
mc:Ignorable="d">
10+
11+
<Grid>
12+
<TextBlock HorizontalAlignment="Center"
13+
VerticalAlignment="Center"
14+
FontSize="48"
15+
FontWeight="SemiBold"
16+
Text="2" />
17+
</Grid>
18+
</Page>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace TitleBarExperiment.Samples;
6+
/// <summary>
7+
/// An empty page that can be used on its own or navigated to within a Frame.
8+
/// </summary>
9+
public sealed partial class SecondPage : Page
10+
{
11+
public SecondPage()
12+
{
13+
this.InitializeComponent();
14+
}
15+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<Page x:Class="TitleBarExperiment.Samples.ShellPage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="using:TitleBarExperiment.Samples"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
9+
mc:Ignorable="d">
10+
11+
<Grid>
12+
<Grid.RowDefinitions>
13+
<RowDefinition Height="Auto" />
14+
<RowDefinition Height="*" />
15+
</Grid.RowDefinitions>
16+
17+
<controls:TitleBar x:Name="appTitleBar"
18+
Title="Contoso"
19+
AutoConfigureCustomTitleBar="True"
20+
BackButtonClick="appTitleBar_BackButtonClick"
21+
DisplayMode="Tall"
22+
IsBackButtonVisible="True"
23+
IsPaneButtonVisible="True"
24+
PaneButtonClick="appTitleBar_PaneButtonClick"
25+
Subtitle="Preview">
26+
<controls:TitleBar.Icon>
27+
<BitmapIcon ShowAsMonochrome="False"
28+
UriSource="ms-appx:///Assets/AppTitleBarIcon.png" />
29+
</controls:TitleBar.Icon>
30+
<controls:TitleBar.Content>
31+
<AutoSuggestBox PlaceholderText="Search.." />
32+
</controls:TitleBar.Content>
33+
<controls:TitleBar.Footer>
34+
<Button Width="32"
35+
Height="32"
36+
Padding="0"
37+
BorderBrush="{ThemeResource CircleElevationBorderBrush}"
38+
CornerRadius="16">
39+
<Button.Content>
40+
<muxc:PersonPicture Width="32"
41+
Height="32"
42+
Initials="AB"
43+
ProfilePicture="ms-appx:///Assets/Avatar.png" />
44+
</Button.Content>
45+
<Button.Flyout>
46+
<MenuFlyout Placement="Bottom">
47+
<MenuFlyoutItem Text="Manage account">
48+
<MenuFlyoutItem.Icon>
49+
<FontIcon Glyph="&#xE77B;" />
50+
</MenuFlyoutItem.Icon>
51+
</MenuFlyoutItem>
52+
<MenuFlyoutSeparator />
53+
<MenuFlyoutItem Text="Settings">
54+
<MenuFlyoutItem.Icon>
55+
<FontIcon Glyph="&#xE713;" />
56+
</MenuFlyoutItem.Icon>
57+
</MenuFlyoutItem>
58+
</MenuFlyout>
59+
</Button.Flyout>
60+
</Button>
61+
</controls:TitleBar.Footer>
62+
</controls:TitleBar>
63+
<muxc:NavigationView x:Name="NavView"
64+
Grid.Row="1"
65+
IsBackButtonVisible="Collapsed"
66+
IsPaneToggleButtonVisible="False"
67+
IsSettingsVisible="False"
68+
Loaded="NavView_Loaded"
69+
SelectionChanged="NavView_SelectionChanged">
70+
<muxc:NavigationView.MenuItems>
71+
<muxc:NavigationViewItem Content="First item"
72+
Tag="1">
73+
<muxc:NavigationViewItem.Icon>
74+
<FontIcon Glyph="&#xE787;" />
75+
</muxc:NavigationViewItem.Icon>
76+
</muxc:NavigationViewItem>
77+
<muxc:NavigationViewItem Content="Second item"
78+
Tag="2">
79+
<muxc:NavigationViewItem.Icon>
80+
<FontIcon Glyph="&#xE7C5;" />
81+
</muxc:NavigationViewItem.Icon>
82+
</muxc:NavigationViewItem>
83+
</muxc:NavigationView.MenuItems>
84+
<Frame x:Name="NavFrame"
85+
Navigated="NavFrame_Navigated" />
86+
</muxc:NavigationView>
87+
</Grid>
88+
</Page>

0 commit comments

Comments
 (0)