File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 88//
99//*********************************************************
1010
11+ using Microsoft . UI ;
12+ using Microsoft . UI . Windowing ;
1113using Microsoft . UI . Xaml ;
14+ using System ;
1215using System . Collections . Generic ;
16+ using WinRT . Interop ;
1317
1418namespace AppUIBasics . Helper
1519{
@@ -35,6 +39,13 @@ static public void TrackWindow(Window window)
3539 _activeWindows . Add ( window ) ;
3640 }
3741
42+ static public AppWindow GetAppWindow ( Window window )
43+ {
44+ IntPtr hWnd = WindowNative . GetWindowHandle ( window ) ;
45+ WindowId wndId = Win32Interop . GetWindowIdFromWindow ( hWnd ) ;
46+ return AppWindow . GetFromWindowId ( wndId ) ;
47+ }
48+
3849 static public Window GetWindowForElement ( UIElement element )
3950 {
4051 if ( element . XamlRoot != null )
Original file line number Diff line number Diff line change 1717using AppUIBasics . Data ;
1818using AppUIBasics . Helper ;
1919using Microsoft . UI . Dispatching ;
20+ using Microsoft . UI . Windowing ;
2021using Microsoft . UI . Xaml ;
2122using Microsoft . UI . Xaml . Automation ;
2223using Microsoft . UI . Xaml . Controls ;
@@ -92,10 +93,14 @@ public NavigationRootPage()
9293 Loaded += delegate ( object sender , RoutedEventArgs e )
9394 {
9495 NavigationOrientationHelper . UpdateTitleBarForElement ( NavigationOrientationHelper . IsLeftMode ( ) , this ) ;
95- WindowHelper . GetWindowForElement ( this ) . Title = AppTitleText ;
96- var window = WindowHelper . GetWindowForElement ( sender as UIElement ) ;
96+
97+ Window window = WindowHelper . GetWindowForElement ( sender as UIElement ) ;
98+ window . Title = AppTitleText ;
9799 window . ExtendsContentIntoTitleBar = true ;
98100 window . SetTitleBar ( this . AppTitleBar ) ;
101+
102+ AppWindow appWindow = WindowHelper . GetAppWindow ( window ) ;
103+ appWindow . SetIcon ( "Assets/Tiles/GalleryIcon.ico" ) ;
99104 } ;
100105
101106 NavigationViewControl . RegisterPropertyChangedCallback ( NavigationView . PaneDisplayModeProperty , new DependencyPropertyChangedCallback ( OnPaneDisplayModeChanged ) ) ;
Original file line number Diff line number Diff line change 8585 <Content Remove =" @(Content)" />
8686 </ItemGroup >
8787 <ItemGroup >
88+ <None Remove =" Assets\Tiles\GalleryIcon.ico" />
8889 <None Remove =" ControlPagesSampleCode\Typography\TypographySample_xaml.txt" />
8990 <None Remove =" ControlPages\DesignGuidance\ColorsPage.xaml" />
9091 <None Remove =" ControlPages\LinePage.xaml" />
107108 <Content Include =" Assets\HomeHeaderTiles\Header-Toolkit.png" />
108109 <Content Include =" Assets\HomeHeaderTiles\Header-WindowsDesign.png" />
109110 <Content Include =" Assets\HomeHeaderTiles\Header-WinUIGallery.png" />
111+ <Content Include =" Assets\Tiles\GalleryIcon.ico" />
110112 <Content Include =" Assets\Tiles\SmallTile-sdk.altform-lightunplated_targetsize-16.png" />
111113 <Content Include =" Assets\Tiles\SmallTile-sdk.altform-lightunplated_targetsize-24.png" />
112114 <Content Include =" Assets\Tiles\SmallTile-sdk.altform-lightunplated_targetsize-256.png" />
You can’t perform that action at this time.
0 commit comments