diff --git a/WinUIGallery.sln b/WinUIGallery.sln index ae6f694c9..d3a087a0b 100644 --- a/WinUIGallery.sln +++ b/WinUIGallery.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.1.32319.34 @@ -21,9 +21,11 @@ Global Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Debug-Unpackaged|ARM64 = Debug-Unpackaged|ARM64 + Debug-Unpackaged|ARM64EC = Debug-Unpackaged|ARM64EC Debug-Unpackaged|x64 = Debug-Unpackaged|x64 Debug-Unpackaged|x86 = Debug-Unpackaged|x86 Preview|ARM64 = Preview|ARM64 + Preview|ARM64EC = Preview|ARM64EC Preview|x64 = Preview|x64 Preview|x86 = Preview|x86 Release|ARM64 = Release|ARM64 @@ -31,15 +33,19 @@ Global Release|x64 = Release|x64 Release|x86 = Release|x86 Release-Unpackaged|ARM64 = Release-Unpackaged|ARM64 + Release-Unpackaged|ARM64EC = Release-Unpackaged|ARM64EC Release-Unpackaged|x64 = Release-Unpackaged|x64 Release-Unpackaged|x86 = Release-Unpackaged|x86 Sideload|ARM64 = Sideload|ARM64 + Sideload|ARM64EC = Sideload|ARM64EC Sideload|x64 = Sideload|x64 Sideload|x86 = Sideload|x86 Stable|ARM64 = Stable|ARM64 + Stable|ARM64EC = Stable|ARM64EC Stable|x64 = Stable|x64 Stable|x86 = Stable|x86 Store|ARM64 = Store|ARM64 + Store|ARM64EC = Store|ARM64EC Store|x64 = Store|x64 Store|x86 = Store|x86 EndGlobalSection @@ -58,6 +64,9 @@ Global {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug|x86.Deploy.0 = Debug|x86 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug-Unpackaged|ARM64.ActiveCfg = Debug-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug-Unpackaged|ARM64.Build.0 = Debug-Unpackaged|ARM64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug-Unpackaged|ARM64EC.ActiveCfg = Debug-Unpackaged|x64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug-Unpackaged|ARM64EC.Build.0 = Debug-Unpackaged|x64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug-Unpackaged|ARM64EC.Deploy.0 = Debug-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug-Unpackaged|x64.ActiveCfg = Debug-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug-Unpackaged|x64.Build.0 = Debug-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Debug-Unpackaged|x86.ActiveCfg = Debug-Unpackaged|x86 @@ -65,6 +74,8 @@ Global {D78F3B56-340D-44F0-9AF1-320D473BA611}.Preview|ARM64.ActiveCfg = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Preview|ARM64.Build.0 = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Preview|ARM64.Deploy.0 = Release-Unpackaged|ARM64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Preview|ARM64EC.ActiveCfg = Release|ARM64EC + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Preview|ARM64EC.Build.0 = Release|ARM64EC {D78F3B56-340D-44F0-9AF1-320D473BA611}.Preview|x64.ActiveCfg = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Preview|x64.Build.0 = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Preview|x64.Deploy.0 = Release-Unpackaged|x64 @@ -85,6 +96,9 @@ Global {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release|x86.Deploy.0 = Release|x86 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release-Unpackaged|ARM64.ActiveCfg = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release-Unpackaged|ARM64.Build.0 = Release-Unpackaged|ARM64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release-Unpackaged|ARM64EC.ActiveCfg = Release-Unpackaged|x64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release-Unpackaged|ARM64EC.Build.0 = Release-Unpackaged|x64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release-Unpackaged|ARM64EC.Deploy.0 = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release-Unpackaged|x64.ActiveCfg = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release-Unpackaged|x64.Build.0 = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Release-Unpackaged|x86.ActiveCfg = Release-Unpackaged|x86 @@ -92,6 +106,8 @@ Global {D78F3B56-340D-44F0-9AF1-320D473BA611}.Sideload|ARM64.ActiveCfg = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Sideload|ARM64.Build.0 = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Sideload|ARM64.Deploy.0 = Release-Unpackaged|ARM64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Sideload|ARM64EC.ActiveCfg = Debug|ARM64EC + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Sideload|ARM64EC.Build.0 = Debug|ARM64EC {D78F3B56-340D-44F0-9AF1-320D473BA611}.Sideload|x64.ActiveCfg = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Sideload|x64.Build.0 = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Sideload|x64.Deploy.0 = Release-Unpackaged|x64 @@ -101,6 +117,8 @@ Global {D78F3B56-340D-44F0-9AF1-320D473BA611}.Stable|ARM64.ActiveCfg = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Stable|ARM64.Build.0 = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Stable|ARM64.Deploy.0 = Release-Unpackaged|ARM64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Stable|ARM64EC.ActiveCfg = Release|ARM64EC + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Stable|ARM64EC.Build.0 = Release|ARM64EC {D78F3B56-340D-44F0-9AF1-320D473BA611}.Stable|x64.ActiveCfg = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Stable|x64.Build.0 = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Stable|x64.Deploy.0 = Release-Unpackaged|x64 @@ -110,6 +128,8 @@ Global {D78F3B56-340D-44F0-9AF1-320D473BA611}.Store|ARM64.ActiveCfg = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Store|ARM64.Build.0 = Release-Unpackaged|ARM64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Store|ARM64.Deploy.0 = Release-Unpackaged|ARM64 + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Store|ARM64EC.ActiveCfg = Release|ARM64EC + {D78F3B56-340D-44F0-9AF1-320D473BA611}.Store|ARM64EC.Build.0 = Release|ARM64EC {D78F3B56-340D-44F0-9AF1-320D473BA611}.Store|x64.ActiveCfg = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Store|x64.Build.0 = Release-Unpackaged|x64 {D78F3B56-340D-44F0-9AF1-320D473BA611}.Store|x64.Deploy.0 = Release-Unpackaged|x64 @@ -131,6 +151,8 @@ Global {94B9B3F5-AF8E-4401-876B-115C44986161}.Debug-Unpackaged|ARM64.ActiveCfg = Debug|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Debug-Unpackaged|ARM64.Build.0 = Debug|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Debug-Unpackaged|ARM64.Deploy.0 = Debug|ARM64 + {94B9B3F5-AF8E-4401-876B-115C44986161}.Debug-Unpackaged|ARM64EC.ActiveCfg = Debug|ARM64EC + {94B9B3F5-AF8E-4401-876B-115C44986161}.Debug-Unpackaged|ARM64EC.Build.0 = Debug|ARM64EC {94B9B3F5-AF8E-4401-876B-115C44986161}.Debug-Unpackaged|x64.ActiveCfg = Debug|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Debug-Unpackaged|x64.Build.0 = Debug|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Debug-Unpackaged|x64.Deploy.0 = Debug|x64 @@ -140,6 +162,8 @@ Global {94B9B3F5-AF8E-4401-876B-115C44986161}.Preview|ARM64.ActiveCfg = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Preview|ARM64.Build.0 = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Preview|ARM64.Deploy.0 = Release|ARM64 + {94B9B3F5-AF8E-4401-876B-115C44986161}.Preview|ARM64EC.ActiveCfg = Release|ARM64EC + {94B9B3F5-AF8E-4401-876B-115C44986161}.Preview|ARM64EC.Build.0 = Release|ARM64EC {94B9B3F5-AF8E-4401-876B-115C44986161}.Preview|x64.ActiveCfg = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Preview|x64.Build.0 = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Preview|x64.Deploy.0 = Release|x64 @@ -161,6 +185,8 @@ Global {94B9B3F5-AF8E-4401-876B-115C44986161}.Release-Unpackaged|ARM64.ActiveCfg = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Release-Unpackaged|ARM64.Build.0 = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Release-Unpackaged|ARM64.Deploy.0 = Release|ARM64 + {94B9B3F5-AF8E-4401-876B-115C44986161}.Release-Unpackaged|ARM64EC.ActiveCfg = Release|ARM64EC + {94B9B3F5-AF8E-4401-876B-115C44986161}.Release-Unpackaged|ARM64EC.Build.0 = Release|ARM64EC {94B9B3F5-AF8E-4401-876B-115C44986161}.Release-Unpackaged|x64.ActiveCfg = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Release-Unpackaged|x64.Build.0 = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Release-Unpackaged|x64.Deploy.0 = Release|x64 @@ -170,6 +196,8 @@ Global {94B9B3F5-AF8E-4401-876B-115C44986161}.Sideload|ARM64.ActiveCfg = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Sideload|ARM64.Build.0 = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Sideload|ARM64.Deploy.0 = Release|ARM64 + {94B9B3F5-AF8E-4401-876B-115C44986161}.Sideload|ARM64EC.ActiveCfg = Debug|ARM64EC + {94B9B3F5-AF8E-4401-876B-115C44986161}.Sideload|ARM64EC.Build.0 = Debug|ARM64EC {94B9B3F5-AF8E-4401-876B-115C44986161}.Sideload|x64.ActiveCfg = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Sideload|x64.Build.0 = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Sideload|x64.Deploy.0 = Release|x64 @@ -179,6 +207,8 @@ Global {94B9B3F5-AF8E-4401-876B-115C44986161}.Stable|ARM64.ActiveCfg = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Stable|ARM64.Build.0 = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Stable|ARM64.Deploy.0 = Release|ARM64 + {94B9B3F5-AF8E-4401-876B-115C44986161}.Stable|ARM64EC.ActiveCfg = Release|ARM64EC + {94B9B3F5-AF8E-4401-876B-115C44986161}.Stable|ARM64EC.Build.0 = Release|ARM64EC {94B9B3F5-AF8E-4401-876B-115C44986161}.Stable|x64.ActiveCfg = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Stable|x64.Build.0 = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Stable|x64.Deploy.0 = Release|x64 @@ -188,6 +218,8 @@ Global {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|ARM64.ActiveCfg = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|ARM64.Build.0 = Release|ARM64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|ARM64.Deploy.0 = Release|ARM64 + {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|ARM64EC.ActiveCfg = Release|ARM64EC + {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|ARM64EC.Build.0 = Release|ARM64EC {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|x64.ActiveCfg = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|x64.Build.0 = Release|x64 {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|x64.Deploy.0 = Release|x64 @@ -196,48 +228,64 @@ Global {94B9B3F5-AF8E-4401-876B-115C44986161}.Store|x86.Deploy.0 = Release|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug|ARM64.ActiveCfg = Debug|ARM64 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug|ARM64.Build.0 = Debug|ARM64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Debug|ARM64EC.ActiveCfg = Debug|x64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Debug|ARM64EC.Build.0 = Debug|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug|x64.ActiveCfg = Debug|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug|x64.Build.0 = Debug|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug|x86.ActiveCfg = Debug|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug|x86.Build.0 = Debug|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug-Unpackaged|ARM64.ActiveCfg = Debug|ARM64 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug-Unpackaged|ARM64.Build.0 = Debug|ARM64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Debug-Unpackaged|ARM64EC.ActiveCfg = Sideload|x64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Debug-Unpackaged|ARM64EC.Build.0 = Sideload|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug-Unpackaged|x64.ActiveCfg = Debug|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug-Unpackaged|x64.Build.0 = Debug|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug-Unpackaged|x86.ActiveCfg = Debug|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Debug-Unpackaged|x86.Build.0 = Debug|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Preview|ARM64.ActiveCfg = Preview|ARM64 {8ED42919-1635-44E4-A670-9329B07F1398}.Preview|ARM64.Build.0 = Preview|ARM64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Preview|ARM64EC.ActiveCfg = Preview|x64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Preview|ARM64EC.Build.0 = Preview|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Preview|x64.ActiveCfg = Preview|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Preview|x64.Build.0 = Preview|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Preview|x86.ActiveCfg = Preview|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Preview|x86.Build.0 = Preview|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Release|ARM64.ActiveCfg = Release|ARM64 {8ED42919-1635-44E4-A670-9329B07F1398}.Release|ARM64.Build.0 = Release|ARM64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Release|ARM64EC.ActiveCfg = Release|x64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Release|ARM64EC.Build.0 = Release|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Release|x64.ActiveCfg = Release|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Release|x64.Build.0 = Release|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Release|x86.ActiveCfg = Release|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Release|x86.Build.0 = Release|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Release-Unpackaged|ARM64.ActiveCfg = Release|ARM64 {8ED42919-1635-44E4-A670-9329B07F1398}.Release-Unpackaged|ARM64.Build.0 = Release|ARM64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Release-Unpackaged|ARM64EC.ActiveCfg = Release|x64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Release-Unpackaged|ARM64EC.Build.0 = Release|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Release-Unpackaged|x64.ActiveCfg = Release|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Release-Unpackaged|x64.Build.0 = Release|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Release-Unpackaged|x86.ActiveCfg = Release|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Release-Unpackaged|x86.Build.0 = Release|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Sideload|ARM64.ActiveCfg = Sideload|ARM64 {8ED42919-1635-44E4-A670-9329B07F1398}.Sideload|ARM64.Build.0 = Sideload|ARM64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Sideload|ARM64EC.ActiveCfg = Sideload|x64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Sideload|ARM64EC.Build.0 = Sideload|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Sideload|x64.ActiveCfg = Sideload|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Sideload|x64.Build.0 = Sideload|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Sideload|x86.ActiveCfg = Sideload|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Sideload|x86.Build.0 = Sideload|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Stable|ARM64.ActiveCfg = Stable|ARM64 {8ED42919-1635-44E4-A670-9329B07F1398}.Stable|ARM64.Build.0 = Stable|ARM64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Stable|ARM64EC.ActiveCfg = Stable|x64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Stable|ARM64EC.Build.0 = Stable|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Stable|x64.ActiveCfg = Stable|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Stable|x64.Build.0 = Stable|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Stable|x86.ActiveCfg = Stable|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Stable|x86.Build.0 = Stable|x86 {8ED42919-1635-44E4-A670-9329B07F1398}.Store|ARM64.ActiveCfg = Store|ARM64 {8ED42919-1635-44E4-A670-9329B07F1398}.Store|ARM64.Build.0 = Store|ARM64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Store|ARM64EC.ActiveCfg = Store|x64 + {8ED42919-1635-44E4-A670-9329B07F1398}.Store|ARM64EC.Build.0 = Store|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Store|x64.ActiveCfg = Store|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Store|x64.Build.0 = Store|x64 {8ED42919-1635-44E4-A670-9329B07F1398}.Store|x86.ActiveCfg = Store|x86 @@ -249,4 +297,4 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {5B033CDA-6491-405C-A05B-CEE6AC4060B9} EndGlobalSection -EndGlobal \ No newline at end of file +EndGlobal diff --git a/WinUIGallery/App.xaml b/WinUIGallery/App.xaml index e0e2d8e3d..1d2895e51 100644 --- a/WinUIGallery/App.xaml +++ b/WinUIGallery/App.xaml @@ -25,6 +25,7 @@ + diff --git a/WinUIGallery/App.xaml.cs b/WinUIGallery/App.xaml.cs index 2bf88d799..bbf88c6dd 100644 --- a/WinUIGallery/App.xaml.cs +++ b/WinUIGallery/App.xaml.cs @@ -12,7 +12,6 @@ using System.Linq; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Navigation; using Microsoft.Windows.AppLifecycle; using Microsoft.Windows.AppNotifications; using Microsoft.Windows.AppNotifications.Builder; @@ -28,19 +27,11 @@ namespace WinUIGallery; /// sealed partial class App : Application { - private static Window startupWindow; - private static Win32WindowHelper win32WindowHelper; + internal static MainWindow MainWindow { get; private set; } = null!; + private static int registeredKeyPressedHook = 0; private HookProc keyEventHook; - /// - /// Get the initial window created for this app. - /// - public static Window StartupWindow - { - get => startupWindow; - } - /// /// Initializes the singleton Application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). @@ -60,11 +51,8 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar { IdleSynchronizer.Init(); - startupWindow = WindowHelper.CreateWindow(); - startupWindow.ExtendsContentIntoTitleBar = true; - - win32WindowHelper = new Win32WindowHelper(startupWindow); - win32WindowHelper.SetWindowMinMaxSize(new Win32WindowHelper.POINT() { x = 500, y = 500 }); + MainWindow = new MainWindow(); + WindowHelper.TrackWindow(MainWindow); #if DEBUG if (Debugger.IsAttached) @@ -105,9 +93,7 @@ private async void EnsureWindow() { await ControlInfoDataSource.Instance.GetGroupsAsync(); await IconsDataSource.Instance.LoadIcons(); - - Frame rootFrame = GetRootFrame(); - + MainWindow.AddNavigationMenuItems(); ThemeHelper.Initialize(); var targetPageType = typeof(HomePage); @@ -138,57 +124,16 @@ private async void EnsureWindow() } } - var rootPage = StartupWindow.Content as NavigationRootPage; - rootPage.Navigate(targetPageType, targetPageArguments); + MainWindow.Navigate(targetPageType, targetPageArguments); if (targetPageType == typeof(HomePage)) { - var navItem = (NavigationViewItem)rootPage.NavigationView.MenuItems[0]; + var navItem = (NavigationViewItem)MainWindow.NavigationView.MenuItems[0]; navItem.IsSelected = true; } // Activate the startup window. - StartupWindow.Activate(); - } - - /// - /// Gets the frame of the StartupWindow. - /// - /// The frame of the StartupWindow. - /// Thrown if the window doesn't have a frame with the name "rootFrame". - public Frame GetRootFrame() - { - Frame rootFrame; - if (StartupWindow.Content is NavigationRootPage rootPage) - { - rootFrame = (Frame)rootPage.FindName("rootFrame"); - } - else - { - rootPage = new NavigationRootPage(); - rootFrame = (Frame)rootPage.FindName("rootFrame"); - if (rootFrame == null) - { - throw new Exception("Root frame not found"); - } - SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); - rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; - rootFrame.NavigationFailed += OnNavigationFailed; - - StartupWindow.Content = rootPage; - } - - return rootFrame; - } - - /// - /// Invoked when Navigation to a certain page fails - /// - /// The Frame which failed navigation - /// Details about the navigation failure - void OnNavigationFailed(object sender, NavigationFailedEventArgs e) - { - throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + MainWindow.Activate(); } /// diff --git a/WinUIGallery/Helpers/EnumHelper.cs b/WinUIGallery/Helpers/EnumHelper.cs index 50118e08d..d12d8b4cb 100644 --- a/WinUIGallery/Helpers/EnumHelper.cs +++ b/WinUIGallery/Helpers/EnumHelper.cs @@ -5,7 +5,7 @@ namespace WinUIGallery.Helpers; internal static class EnumHelper { /// - /// Converts a string into an enum. + /// Converts a string into a enum. /// /// The output enum type. /// The input text. diff --git a/WinUIGallery/Helpers/NavigationHelper.cs b/WinUIGallery/Helpers/NavigationHelper.cs index e321decdf..5ea74c0d7 100644 --- a/WinUIGallery/Helpers/NavigationHelper.cs +++ b/WinUIGallery/Helpers/NavigationHelper.cs @@ -187,11 +187,6 @@ public RootFrameNavigationHelper(Frame rootFrame, NavigationView currentNavView) } this.Frame = rootFrame; - this.Frame.Navigated += (s, e) => - { - // Update the Back button whenever a navigation occurs. - UpdateBackButton(); - }; this.CurrentNavView = currentNavView; CurrentNavView.BackRequested += NavView_BackRequested; @@ -296,11 +291,6 @@ private bool TryGoForward() } return navigated; } - - private void UpdateBackButton() - { - this.CurrentNavView.IsBackEnabled = this.Frame.CanGoBack ? true : false; - } } /// diff --git a/WinUIGallery/Helpers/NavigationOrientationHelper.cs b/WinUIGallery/Helpers/NavigationOrientationHelper.cs index e2f834a02..b7760cbcf 100644 --- a/WinUIGallery/Helpers/NavigationOrientationHelper.cs +++ b/WinUIGallery/Helpers/NavigationOrientationHelper.cs @@ -29,9 +29,9 @@ public static bool IsLeftMode() } } - public static void IsLeftModeForElement(bool isLeftMode, UIElement element) + public static void IsLeftModeForElement(bool isLeftMode) { - UpdateNavigationViewForElement(isLeftMode, element); + UpdateNavigationViewForElement(isLeftMode); if (NativeHelper.IsAppPackaged) { ApplicationData.Current.LocalSettings.Values[IsLeftModeKey] = isLeftMode; @@ -42,19 +42,16 @@ public static void IsLeftModeForElement(bool isLeftMode, UIElement element) } } - public static void UpdateNavigationViewForElement(bool isLeftMode, UIElement element) + public static void UpdateNavigationViewForElement(bool isLeftMode) { - NavigationView _navView = NavigationRootPage.GetForElement(element).NavigationView; + NavigationView _navView = App.MainWindow.NavigationView; if (isLeftMode) { _navView.PaneDisplayMode = NavigationViewPaneDisplayMode.Auto; - Grid.SetRow(_navView, 0); } else { _navView.PaneDisplayMode = NavigationViewPaneDisplayMode.Top; - Grid.SetRow(_navView, 1); } } - } diff --git a/WinUIGallery/Helpers/ProtocolActivationClipboardHelper.cs b/WinUIGallery/Helpers/ProtocolActivationClipboardHelper.cs index 586ed1e1e..6011da495 100644 --- a/WinUIGallery/Helpers/ProtocolActivationClipboardHelper.cs +++ b/WinUIGallery/Helpers/ProtocolActivationClipboardHelper.cs @@ -50,14 +50,23 @@ public static bool ShowCopyLinkTeachingTip public static void Copy(ControlInfoDataItem item) { - var uri = new Uri($"winui3gallery://item/{item.UniqueId}", UriKind.Absolute); - ProtocolActivationClipboardHelper.Copy(uri, $"{Package.Current.DisplayName} - {item.Title} Sample"); + var uri = new Uri($"{GetAppName()}://item/{item.UniqueId}", UriKind.Absolute); + Copy(uri, $"{Package.Current.DisplayName} - {item.Title} Sample"); } public static void Copy(ControlInfoDataGroup group) { - var uri = new Uri($"winui3gallery://category/{group.UniqueId}", UriKind.Absolute); - ProtocolActivationClipboardHelper.Copy(uri, $"{Package.Current.DisplayName} - {group.Title} Samples"); + var uri = new Uri($"{GetAppName()}://category/{group.UniqueId}", UriKind.Absolute); + Copy(uri, $"{Package.Current.DisplayName} - {group.Title} Samples"); + } + + private static string GetAppName() + { +#if DEBUG + return "winui3gallerydev"; +#else + return "winui3gallery"; +#endif } private static void Copy(Uri uri, string displayName) diff --git a/WinUIGallery/Helpers/TitleBarHelper.cs b/WinUIGallery/Helpers/TitleBarHelper.cs index c031867a7..5b26e12cc 100644 --- a/WinUIGallery/Helpers/TitleBarHelper.cs +++ b/WinUIGallery/Helpers/TitleBarHelper.cs @@ -6,11 +6,11 @@ namespace WinUIGallery.Helpers; internal class TitleBarHelper { - // workaround as Appwindow titlebar doesn't update caption button colors correctly when changed while app is running + // workaround as AppWindow TitleBar doesn't update caption button colors correctly when changed while app is running // https://task.ms/44172495 public static Windows.UI.Color ApplySystemThemeToCaptionButtons(Window window) { - var frame = (Application.Current as WinUIGallery.App).GetRootFrame() as FrameworkElement; + var frame = App.MainWindow.GetRootFrame() as FrameworkElement; Windows.UI.Color color; if (frame.ActualTheme == ElementTheme.Dark) { @@ -20,7 +20,7 @@ public static Windows.UI.Color ApplySystemThemeToCaptionButtons(Window window) { color = Colors.Black; } - SetCaptionButtonColors(window,color); + SetCaptionButtonColors(window, color); return color; } diff --git a/WinUIGallery/Pages/NavigationRootPage.xaml b/WinUIGallery/MainWindow.xaml similarity index 73% rename from WinUIGallery/Pages/NavigationRootPage.xaml rename to WinUIGallery/MainWindow.xaml index b12daf111..b50f9bd13 100644 --- a/WinUIGallery/Pages/NavigationRootPage.xaml +++ b/WinUIGallery/MainWindow.xaml @@ -1,63 +1,55 @@ - - + - - - - - - + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="using:WinUIGallery" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:pages="using:WinUIGallery.Pages" + Title="MainWindow" + mc:Ignorable="d"> + + + + - - - - - - - + + + + + - - - - - + x:FieldModifier="public" + KeyboardAcceleratorPlacementMode="Hidden" + PlaceholderText="Search samples.." + QueryIcon="Find" + QuerySubmitted="OnControlsSearchBoxQuerySubmitted" + TextChanged="OnControlsSearchBoxTextChanged"> + + + + + + + - - - - - - - - - - - - - - - - - - Foreground Color - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + + + + + + + -<!--UIElement set as titlebar--> -<Border x:Name="AppTitleBar" Grid.Column="1" VerticalAlignment="Top"> - <TextBlock x:Name="AppTitle" Text="{StaticResource AppTitleName}" VerticalAlignment="Top" Margin="0,8,0,0" /> -</Border> - +<TitleBar + Title="$(Title)" + Subtitle=""$(Subtitle)" + IsBackButtonVisible="$(BackButtonVisibility)" + IsPaneToggleButtonVisible="$(PaneToggleVisibility)"> + <TitleBar.IconSource> + <ImageIconSource ImageSource="/Assets/Tiles/GalleryIcon.ico" /> + </TitleBar.IconSource> + <TitleBar.Content> + <AutoSuggestBox + Width="360" + VerticalAlignment="Center" + PlaceholderText="Search.." + QueryIcon="Find" /> + </TitleBar.Content> + <TitleBar.RightHeader> + <PersonPicture + Width="30" + Height="30" + Initials="JD" /> + </TitleBar.RightHeader> +</TitleBar> + + + + + + + - + + - - - WinUI custom titlebar supports setting a custom height by configuring the PreferredHeightOption property of the titlebar. This feature is useful when you need to adjust the titlebar height to match your app's design or accommodate additional content. - - - - This option will be invalid when the style of titlebar is reset to system titlebar! - - - - - Tall - Standard - Collapsed - - + + + - - - - - diff --git a/WinUIGallery/Samples/ControlPages/TitleBarPage.xaml.cs b/WinUIGallery/Samples/ControlPages/TitleBarPage.xaml.cs index a81772f8e..298bab657 100644 --- a/WinUIGallery/Samples/ControlPages/TitleBarPage.xaml.cs +++ b/WinUIGallery/Samples/ControlPages/TitleBarPage.xaml.cs @@ -7,238 +7,22 @@ // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. // //********************************************************* -using WinUIGallery.Helpers; -using Microsoft.UI; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Shapes; -using System.Threading.Tasks; -using Microsoft.UI.Windowing; -using Microsoft.UI.Xaml.Navigation; -using Microsoft.UI.Input; -using Windows.Foundation; -using System; +using WinUIGallery.Samples.SamplePages; namespace WinUIGallery.ControlPages; public sealed partial class TitleBarPage : Page { - private Windows.UI.Color currentBgColor = Colors.Transparent; - private Windows.UI.Color currentFgColor = ThemeHelper.ActualTheme == ElementTheme.Dark ? Colors.White : Colors.Black; - private bool sizeChangedEventHandlerAdded = false; - public TitleBarPage() { this.InitializeComponent(); - Loaded += (object sender, RoutedEventArgs e) => - { - (sender as TitleBarPage).UpdateTitleBarColor(); - UpdateButtonText(); - }; - } - - protected override void OnNavigatedFrom(NavigationEventArgs e) - { - ResetTitlebarSettings(); - } - - private void SetTitleBar(bool forceCustomTitlebar = false) - { - var window = WindowHelper.GetWindowForElement(this as UIElement); - var titleBarElement = UIHelper.FindElementByName(this as UIElement, "AppTitleBar"); - if (forceCustomTitlebar || !window.ExtendsContentIntoTitleBar) - { - titleBarElement.Visibility = Visibility.Visible; - window.ExtendsContentIntoTitleBar = true; - window.SetTitleBar(titleBarElement); - TitleBarHelper.SetCaptionButtonBackgroundColors(window, Colors.Transparent); - } - else - { - titleBarElement.Visibility = Visibility.Collapsed; - window.ExtendsContentIntoTitleBar = false; - TitleBarHelper.SetCaptionButtonBackgroundColors(window, null); - } - UpdateButtonText(); - UpdateTitleBarColor(); - } - - private void ResetTitlebarSettings() - { - var window = WindowHelper.GetWindowForElement(this as UIElement); - SetTitleBar(forceCustomTitlebar: true); - ClearClickThruRegions(); - var txtBoxNonClientArea = UIHelper.FindElementByName(this as UIElement, "AppTitleBarTextBox") as FrameworkElement; - txtBoxNonClientArea.Visibility = Visibility.Collapsed; - addInteractiveElements.Content = "Add interactive control to titlebar"; - } - - private void SetClickThruRegions(Windows.Graphics.RectInt32[] rects) - { - var window = WindowHelper.GetWindowForElement(this as UIElement); - var nonClientInputSrc = InputNonClientPointerSource.GetForWindowId(window.AppWindow.Id); - nonClientInputSrc.SetRegionRects(NonClientRegionKind.Passthrough, rects); - } - - private void ClearClickThruRegions() - { - var window = WindowHelper.GetWindowForElement(this as UIElement); - var noninputsrc = InputNonClientPointerSource.GetForWindowId(window.AppWindow.Id); - noninputsrc.ClearRegionRects(NonClientRegionKind.Passthrough); - } - - public void UpdateButtonText() - { - var window = WindowHelper.GetWindowForElement(this as UIElement); - - if (window.ExtendsContentIntoTitleBar) - { - customTitleBar.Content = "Reset to System TitleBar"; - defaultTitleBar.Content = "Reset to System TitleBar"; - } - else - { - customTitleBar.Content = "Set Custom TitleBar"; - defaultTitleBar.Content = "Set Default Custom TitleBar"; - } - } - private void BgGridView_ItemClick(object sender, ItemClickEventArgs e) + private void CreateTitleBarWindowClick(object sender, RoutedEventArgs e) { - var rect = (Rectangle)e.ClickedItem; - var color = ((SolidColorBrush)rect.Fill).Color; - BackgroundColorElement.Background = new SolidColorBrush(color); - - currentBgColor = color; - UpdateTitleBarColor(); - - // Delay required to circumvent GridView bug: https://github.com/microsoft/microsoft-ui-xaml/issues/6350 - Task.Delay(10).ContinueWith(_ => myBgColorButton.Flyout.Hide(), TaskScheduler.FromCurrentSynchronizationContext()); + TitleBarWindow titleBarWindow = new TitleBarWindow(); + titleBarWindow.Activate(); } - - private void FgGridView_ItemClick(object sender, ItemClickEventArgs e) - { - var rect = (Rectangle)e.ClickedItem; - var color = ((SolidColorBrush)rect.Fill).Color; - - ForegroundColorElement.Background = new SolidColorBrush(color); - - currentFgColor = color; - UpdateTitleBarColor(); - - // Delay required to circumvent GridView bug: https://github.com/microsoft/microsoft-ui-xaml/issues/6350 - Task.Delay(10).ContinueWith(_ => myFgColorButton.Flyout.Hide(), TaskScheduler.FromCurrentSynchronizationContext()); - } - - - public void UpdateTitleBarColor() - { - var window = WindowHelper.GetWindowForElement(this); - var titleBarElement = UIHelper.FindElementByName(this, "AppTitleBar"); - var titleBarAppNameElement = UIHelper.FindElementByName(this, "AppTitle"); - - (titleBarElement as Border).Background = new SolidColorBrush(currentBgColor); // Changing titlebar uielement's color. - - if (currentFgColor != Colors.Transparent) - { - (titleBarAppNameElement as TextBlock).Foreground = new SolidColorBrush(currentFgColor); - } - else - { - (titleBarAppNameElement as TextBlock).Foreground = Application.Current.Resources["TextFillColorPrimaryBrush"] as SolidColorBrush; - } - - TitleBarHelper.SetCaptionButtonColors(window, currentFgColor); - - if (currentBgColor == Colors.Transparent) - { - // If the current background is null, we want to revert to the default titlebar which is achieved using null as color. - TitleBarHelper.SetBackgroundColor(window, null); - } - else - { - TitleBarHelper.SetBackgroundColor(window, currentBgColor); - } - - TitleBarHelper.SetForegroundColor(window, currentFgColor); - } - - private void customTitleBar_Click(object sender, RoutedEventArgs e) - { - SetTitleBar(); - // announce visual change to automation - UIHelper.AnnounceActionForAccessibility(sender as UIElement, "TitleBar size and width changed", "TitleBarChangedNotificationActivityId"); - } - private void defaultTitleBar_Click(object sender, RoutedEventArgs e) - { - SetTitleBar(); - - // announce visual change to automation - UIHelper.AnnounceActionForAccessibility(sender as UIElement, "TitleBar size and width changed", "TitleBarChangedNotificationActivityId"); - } - - private void setTxtBoxAsPasthrough(FrameworkElement txtBoxNonClientArea) - { - GeneralTransform transformTxtBox = txtBoxNonClientArea.TransformToVisual(null); - Rect bounds = transformTxtBox.TransformBounds(new Rect(0, 0, txtBoxNonClientArea.ActualWidth, txtBoxNonClientArea.ActualHeight)); - - var scale = WindowHelper.GetRasterizationScaleForElement(this); - - var transparentRect = new Windows.Graphics.RectInt32( - _X: (int)Math.Round(bounds.X * scale), - _Y: (int)Math.Round(bounds.Y * scale), - _Width: (int)Math.Round(bounds.Width * scale), - _Height: (int)Math.Round(bounds.Height * scale) - ); - var rectArr = new Windows.Graphics.RectInt32[] { transparentRect }; - SetClickThruRegions(rectArr); - } - - private void TitleBarHeightComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - var selectedHeight = titlebarHeight.SelectedItem.ToString(); - var window = WindowHelper.GetWindowForElement(this); - - if (selectedHeight != null && window != null && window.ExtendsContentIntoTitleBar) - { - window.AppWindow.TitleBar.PreferredHeightOption = EnumHelper.GetEnum(selectedHeight); - } - } - - private void AddInteractiveElements_Click(object sender, RoutedEventArgs e) - { - var txtBoxNonClientArea = UIHelper.FindElementByName(sender as UIElement, "AppTitleBarTextBox") as FrameworkElement; - - if (txtBoxNonClientArea.Visibility == Visibility.Visible) - { - ResetTitlebarSettings(); - } - else - { - addInteractiveElements.Content = "Remove interactive control from titlebar"; - txtBoxNonClientArea.Visibility = Visibility.Visible; - if (sizeChangedEventHandlerAdded) - { - setTxtBoxAsPasthrough(txtBoxNonClientArea); - } - else - { - sizeChangedEventHandlerAdded = true; - // run this code when textbox has been made visible and its actual width and height has been calculated - txtBoxNonClientArea.SizeChanged += (object sender, SizeChangedEventArgs e) => - { - if (txtBoxNonClientArea.Visibility != Visibility.Collapsed) - { - setTxtBoxAsPasthrough(txtBoxNonClientArea); - } - }; - } - - // announce visual change to automation - UIHelper.AnnounceActionForAccessibility(sender as UIElement, "TitleBar size and width changed", "TitleBarChangedNotificationActivityId"); - } - } - -} +} \ No newline at end of file diff --git a/WinUIGallery/Samples/Data/ControlInfoData.json b/WinUIGallery/Samples/Data/ControlInfoData.json index 657e32c8c..ac4f0fe11 100644 --- a/WinUIGallery/Samples/Data/ControlInfoData.json +++ b/WinUIGallery/Samples/Data/ControlInfoData.json @@ -3611,20 +3611,20 @@ { "UniqueId": "TitleBar", "Title": "TitleBar", - "ApiNamespace": "Microsoft.UI.Xaml", + "ApiNamespace": "Microsoft.UI.Xaml.Controls", "Subtitle": "An example showing a custom UIElement used as the titlebar for the app's window.", "ImagePath": "ms-appx:///Assets/ControlImages/TitleBar.png", - "Description": "This sample shows how to use a custom titlebar for the app's window. There are 2 ways of doing it: using default titlebar and setting an UIElement as a custom titlebar.", + "Description": "The TitleBar control provides a simple way to create a modern titlebar UX with interactive content.", "Content": "

Look at the TitleBarPage.xaml file in Visual Studio to see the full code for this page.

", "IsUpdated": true, "Docs": [ { - "Title": "TitleBar - API", - "Uri": "https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.window.extendscontentintotitlebar" + "Title": "Title bar customization", + "Uri": "https://learn.microsoft.com/windows/apps/develop/title-bar" }, { - "Title": "Guidelines", - "Uri": "https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.window" + "Title": "Titl bar - design guidelines", + "Uri": "https://learn.microsoft.com/windows/apps/design/basics/titlebar-design" } ], "RelatedControls": [ diff --git a/WinUIGallery/Samples/SamplePages/ModalWindow.xaml.cs b/WinUIGallery/Samples/SamplePages/ModalWindow.xaml.cs index ed7108ca4..f03b62439 100644 --- a/WinUIGallery/Samples/SamplePages/ModalWindow.xaml.cs +++ b/WinUIGallery/Samples/SamplePages/ModalWindow.xaml.cs @@ -23,7 +23,7 @@ public ModalWindow() // Set this modal window's owner (the main application window). // The main window can be retrieved from App.xaml.cs if it's set as a static property. - SetOwnership(appWindow, App.StartupWindow); + SetOwnership(appWindow, App.MainWindow); // Make the window modal (blocks interaction with the owner window until closed). presenter.IsModal = true; @@ -76,7 +76,7 @@ private void SetOwnership(AppWindow ownedAppWindow, Window ownerWindow) private void ModalWindow_Closed(object sender, WindowEventArgs args) { // Reactivate the main application window when the modal window closes. - App.StartupWindow.Activate(); + App.MainWindow.Activate(); } private void OKButton_Click(object sender, RoutedEventArgs e) diff --git a/WinUIGallery/Samples/SamplePages/TitleBarWindow.xaml b/WinUIGallery/Samples/SamplePages/TitleBarWindow.xaml new file mode 100644 index 000000000..f74798b71 --- /dev/null +++ b/WinUIGallery/Samples/SamplePages/TitleBarWindow.xaml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WinUIGallery/Samples/SamplePages/TitleBarWindow.xaml.cs b/WinUIGallery/Samples/SamplePages/TitleBarWindow.xaml.cs new file mode 100644 index 000000000..b89bebd06 --- /dev/null +++ b/WinUIGallery/Samples/SamplePages/TitleBarWindow.xaml.cs @@ -0,0 +1,41 @@ +using System; +using System.Linq; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; + +namespace WinUIGallery.Samples.SamplePages; + +public sealed partial class TitleBarWindow : Window +{ + public TitleBarWindow() + { + this.InitializeComponent(); + this.ExtendsContentIntoTitleBar = true; // Extend the content into the title bar and hide the default title bar + this.AppWindow.TitleBar.PreferredHeightOption = Microsoft.UI.Windowing.TitleBarHeightOption.Tall; + this.SetTitleBar(titleBar); // Set the custom title bar + navView.SelectedItem = navView.MenuItems.OfType().First(); + } + + private void TitleBar_PaneToggleRequested(TitleBar sender, object args) + { + navView.IsPaneOpen = !navView.IsPaneOpen; + } + + private void TitleBar_BackRequested(TitleBar sender, object args) + { + navFrame.GoBack(); + } + + private void navView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) + { + var selectedItem = (NavigationViewItem)args.SelectedItem; + if (selectedItem != null) + { + string selectedItemTag = ((string)selectedItem.Tag); + sender.Header = "Sample Page " + selectedItemTag.Substring(selectedItemTag.Length - 1); + string pageName = "WinUIGallery.SamplePages." + selectedItemTag; + Type pageType = Type.GetType(pageName); + navFrame.Navigate(pageType); + } + } +} diff --git a/WinUIGallery/Styles/TitleBar.xaml b/WinUIGallery/Styles/TitleBar.xaml new file mode 100644 index 000000000..0d384f34d --- /dev/null +++ b/WinUIGallery/Styles/TitleBar.xaml @@ -0,0 +1,286 @@ + + + + + + + + + + + diff --git a/WinUIGallery/WinUIGallery.csproj b/WinUIGallery/WinUIGallery.csproj index 1e87d50d0..45a93dc28 100644 --- a/WinUIGallery/WinUIGallery.csproj +++ b/WinUIGallery/WinUIGallery.csproj @@ -307,6 +307,7 @@ + @@ -314,11 +315,15 @@ + + + + @@ -505,6 +510,18 @@ + + + MSBuild:Compile + + + + + + MSBuild:Compile + + + MSBuild:Compile @@ -555,6 +572,12 @@ MSBuild:Compile + + + + MSBuild:Compile + + MSBuild:Compile diff --git a/standalone.props b/standalone.props index 468ca5a54..78226a094 100644 --- a/standalone.props +++ b/standalone.props @@ -17,8 +17,8 @@ However, because we overwrite those to output to subdirectories, the outputs of the UWP WinUI Gallery are erroneously included. Explicitly exclude them here --> - obj\**;bin\**;$(DefaultItemExcludes) - - obj\generated - + obj\**;bin\**;$(DefaultItemExcludes) + + obj\generated + \ No newline at end of file