What’s new in XAML for Windows 8.1?

//BUILD 2013 concluded last week and there was a ton of stuff to assimilate. I will attempt to summarize a few important changes for C++/XAML/DirectX developers in this blog post., focusing exclusively on the XAML/DirectX Interop scenarios.

If you are interested in knowing what is new with just the XAML framework (new controls, binding features etc), check out this great video from Tim Heuer.

New Stuff for XAML/DirectX interop scenarios using SwapChainPanel

1. A new SwapChainPanel control present in the Windows::UI::Xaml::Controls class.

2. In Windows 8, you were restricted to creating a full screen SwapChainBackgroundPanel and the swap chain had to be present at the root of your control hierarchy. The new SwapChainPanel controls removes these restrictions.

3. This does not mean you can have hundreds of SwapChainPanel controls in your app (Well, not even in the low double digits). Turns out using too many SwapChainPanel controls incurs a heavy cost. So restrict them to at the most 3 or 4. Do not go beyond that.

4. It is composable like any normal XAML element. You can have text layered below or above the control and have the XAML framework render content.

5. A Size Changed notification event provides for crisp re-drawing of content.

New Stuff for XAML/DirectX interop scenarios using the new SiS/VSiS

1. Has updated methods for faster D2D drawing by using drawing with a Direct2D DeviceContext.

2. Using the D2D DeviceContext allows the framework to batch the drawing requests.

3. Supports multi-threaded drawing.

4. Has new methods, SuspendDraw and ResumeDraw to enable you to suspend drawing operations and resume them later.

5. No longer needed to call BeginDraw on the XAML UI thread. In fact, BeginDraw, SuspendDraw and ResumeDraw can be called from any thread.

6. EndDraw should still be called on the UI thread. This allows the XAML framework to update the scene.

SwapChainPanel with Independent Input

1. The new SwapChainPanel now has support for processing touch, pen and mouse input on a background thread. This provides a path for low latency interactivity and high performance.

These are some of the high level changes. I encourage all of you to check out the excellent //BUILD 2013 talk by Bede Jordan,  a Senior Development Lead on the XAML team.

Enjoy the new C++/XAML/DirectX interop stuff in Windows 8.1

-Sridhar