C++ samples that demonstrate basic Win32 use of Xaml using DesktopWindowXamlSource, also known as Xaml Islands.
Minimal - The app client area is all Xaml. The markup is stored as a string and parsed at runtime.
Less that 150 lines of code with 50 of it being markup (the NavigationView
stolen from Terminals Settings UI)
MultiWindow - This demonstrates a mulit-window Win32 app that uses Xaml. This hooks up some handlers to the markups contents to demonstrate how to survive without data binding.
MultiXamlAndWindow - Multi window app that creates 2 islands in each window. Mostly a diagnostic case for testing.
- No Data binding
- Intellisense in the .xaml files is broken, VS is confused seeing a .xaml file in a Win32 app project type.
- Not using WinUI 2.x, using System Xaml instead.
- No Xaml Application object, so no way to provide custom metadata.
- Does not implement accelerator handling or any integration with Win32 UI (who wants to use Win32 UI anyway!).
Look in the debugger output window for Xaml parsing errors, it identifies line and offset of the error.
This is a collection of things that simplify use of Xaml in Win32 style apps. Loading Xaml from a Win32 resource enabling putting the markup in a file outside of the source code..
- To use Islands Apps must specify
maxversiontested
via a manifest, see docs here, see app.manifest used in all of the projects. - XamlWin32Helpers.h is immature and should be enhanced to cover more cases.