原文链接 [https://www.cnblogs.com/densen2014/p/16946311.html]
在 Platforms -> Windows 下的 App.xaml.cs 中,可以通过一些反射用法来检索 AppWindow。 然后可以在 appwindow 实例上设置 Title 属性。
In App.xaml.cs under Platforms -> Windows, the AppWindow can be retreived with some reflection usage. The Title property can then be set on the appwindow instance.
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using WinRT.Interop;
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
base.OnLaunched(args);
var currentWindow = Application.Windows[0].Handler?.PlatformView;
IntPtr _windowHandle = WindowNative.GetWindowHandle(currentWindow);
var windowId = Win32Interop.GetWindowIdFromWindow(_windowHandle);
AppWindow appWindow = AppWindow.GetFromWindowId(windowId);
appWindow.Title = "Title!";
}