Skip to content

Commit 36821a1

Browse files
authored
Merge pull request #271 from unoplatform/dev/ds/windows-title
Update Window Title logic
2 parents 22d848e + 90e13ad commit 36821a1

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/.nuspec/Uno.Resizetizer.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@
595595
Outputs="@(_WindowIconExtension)">
596596

597597
<PropertyGroup>
598-
<WindowTitle Condition="'$(WindowTitle)' == ''">$(ApplicationTitle)</WindowTitle>
598+
<WindowTitle Condition="'$(WindowTitle)' == ''">$([MSBuild]::ValueOrDefault('$(ApplicationTitle)', '$(AssemblyName)'))</WindowTitle>
599599
</PropertyGroup>
600600

601601
<WindowIconGeneratorTask_v0

src/Resizetizer/src/WindowIconGeneratorTask.cs

+21-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,27 @@ public static void SetWindowIcon(this global::Microsoft.UI.Xaml.Window window)
6969
global::Microsoft.UI.Windowing.AppWindow appWindow =
7070
global::Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
7171
appWindow.SetIcon(""{iconName}.ico"");
72-
appWindow.Title = ""{WindowTitle}"";
72+
73+
// Set the Window Title Only if it has the Default WinUI Desktop value and we are running Unpackaged
74+
if (!IsPackaged() && appWindow.Title == ""WinUI Desktop"")
75+
{{
76+
appWindow.Title = ""{WindowTitle}"";
77+
}}
78+
79+
static bool IsPackaged()
80+
{{
81+
try
82+
{{
83+
if (global::Windows.ApplicationModel.Package.Current != null)
84+
return true;
85+
}}
86+
catch
87+
{{
88+
// no-op
89+
}}
90+
91+
return false;
92+
}}
7393
#endif
7494
}}
7595
}}

0 commit comments

Comments
 (0)