Skip to content

Using Xaml in the Win32 app model using DesktopWindowXamlSource

Notifications You must be signed in to change notification settings

luedersj/Win32XamlApp

 
 

Repository files navigation

Win32 Xaml App Samples

C++ samples that demonstrate basic Win32 use of Xaml using DesktopWindowXamlSource, also known as Xaml Islands.

Samples

Minimal - 200 line .cpp file Xaml App

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)

Win32 Xaml App

Multi Window App - Supports multiple top level windows

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.

Win32 Xaml App Multi Window

Multi Xaml Mulit Window App - Each Window hosts 2 Islands

MultiXamlAndWindow - Multi window app that creates 2 islands in each window. Mostly a diagnostic case for testing.

Limitations

  • 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!).

Debugging tips

Look in the debugger output window for Xaml parsing errors, it identifies line and offset of the error.

Xaml Win32 Helpers

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..

Implementation notes

  • 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.

About

Using Xaml in the Win32 app model using DesktopWindowXamlSource

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.3%
  • C 5.7%