CsWinRT icon indicating copy to clipboard operation
CsWinRT copied to clipboard

Why doesn't the code generated by UWP's App.xaml contain the LoadComponent method

Open Gaoyifei1011 opened this issue 8 months ago • 1 comments

Why doesn't the code generated by UWP's App.xaml contain the LoadComponent method

------------------------------------

为什么 UWPApp.xaml 生成的代码没有包含 LoadComponent 方法


Image

如图片所示,WinUI 3(左侧)的 App.xaml 生成的代码 WinUIApp.g.i.cs 包含 LoadComponent 方法,可以加载对应的 App.xaml 文件,但在 UWP(右侧) 中却没有包含相应的实现,如果在 Xaml islands 中,将 App.xaml 修改成其他名称(比如 TestApp.xaml),应用程序在启动时会因为找不到资源而失败

As shown in the picture, the code generated by App.xaml of WinUI 3 (left) contains the LoadComponent method, which can load the corresponding App.xaml file, but the corresponding implementation is not included in UWP (right). If you change App.xaml to something else in Xaml islands, such as TestApp.xaml, the application will fail at startup because the resource cannot be found

Gaoyifei1011 avatar Feb 23 '25 14:02 Gaoyifei1011