Open ericsink opened 2 years ago
You can refer https://github.com/CommunityToolkit/Microsoft.Toolkit.Win32/tree/master/Microsoft.Toolkit.Win32.UI.XamlApplication to implement a WinRT object inherited from Windows.UI.Xaml.Application.
After you implement this object, you can initialize the WinRT XAML via create instance of this object after initializing the COM.
I have made a XAML Islands based toolchain called Mile.Xaml. Here is the Mile.Xaml.Application object implementation: https://github.com/ProjectMile/Mile.Xaml/tree/main/Mile.Xaml. Here is the Mile.Xaml BlankApp example: https://github.com/ProjectMile/Mile.Xaml.Samples/blob/main/MileXamlBlankApp/WinMain.cpp
I hope these XAML Islands related information can help you. Something may be similar for WinUI 3.
Kenji Mouri
Looks like you can get pretty far if you just load app.xaml
as-is in runtime and implementing IXamlMetadataProvider
by forwarding to Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider
This is C# but I guess Swift will behave similarly.
See https://github.com/driver1998/WinUIMinimalXaml for the demo code. (credit goes to @sylveon)
The XamlApp sample is a place where I experiment with support for various WinUI controls.
Controls that work:
Controls that crash: