XAML Changes to Support Universal Windows Platform in Windows 10

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.


XAML is the native UI platform for Windows 10. A native app on Windows 10 will be built using XAML. XAML powers the Universal Windows Platform that is key to Windows 10.

Powering the Universal Windows Platform means that controls have to work in similar ways across different devices. This means that certain controls that seem to be universal in nature in the pre-Windows 10 era needed to be changed to ensure there is a consistent behavior that is ensured by Universal Windows Platform.

One key benefit is that users do not need to have different logic for different device form factors in a Windows 10 world. This will help developers focus on the core logic of their:

New Universal Controls

Pivot: This is great for a one-handed experience on mobiles, and works like tabs on desktop.

ContentDialog: This control was previously on Windows Phone 8.1, but was not present on Windows. On Windows 8, there was a MessageDialog that does not support XAML Content. The refreshed ContentDialog control on Windows 10 works on all devices.

AutoSuggestBox: This is to be used for auto-complete scenarios. This supports IME and glyphs. On Windows Phone, there was a search box, but it was restrictive and it is on the path of deprecation.

Maps: There is a new universal Maps control that replaces Bing Maps. They offer Offline support, 3D, and street-side panoramas.

Impact of Universal Windows Runtime to XAML Developers

There is more to than just one set of universal controls to build applications. The XAML controls have common branding, behavior, scaling, and support diverse inputs.

Note that although views are reusable across devices and displays, they might need tailoring via responsive pages or multiple views.

SplitView controls is an example of how writing XAML code has been simplified. As you can see from the following example, the navigation content is cleanly separated from main content.

For example:

<SplitView DisplayMode="Inline|Overlay|
   <!-- Navigation Content Here -->
   <!-- Main Content Here -->

Triggers and Setters

To simplify responsive view development, there is support for media queries in XAML. You can think of triggers as events in response to which setters are activated. Let us look at an example:

   <Setter Target="splitView.DisplayMode"
      Value="Inline" />

   <AdaptiveTrigger MinWindowWidth="720" />

   <Setter Target="splitView.DisplayMode"
      Value="Overlay" />

   <AdaptiveTrigger MinWindowWidth= "0" />

In the preceding example, when the WindowWidth is more than or equal to 720, the display mode for the SplitView changes to Inline mode and is Overlay mode when it is less than 720.

Binding Changes

There is a new way to bind controls to data sources, via the Bind keyword. The most notable improvement is the behavior to resolve at compile time that can provide compiler errors. This avoids the issues that were observed with Binding. Note that Bind supports only 11 associations at the time of writing the article. Here is an example that shows “binding” in action.

            <SymbolIcon Symbol="{x:Bind Symbol}"/>
            <TextBlock Text="{x:Bind Name}"/>
            <Button Click="{x:Bind Click}"/>

Drag and Drop

Drag and Drop support is extended for windowed applications. There is a new attribute for Grid, called AllowDrop, and has support for event handlers for drag and drop.

<!-- XAML -->
<Grid AllowDrop="True" DragOver="Do_DragOver"
      Drop="Do_Drop" ...>


In the preceding article, we learned about the XAML changes coming in Windows 10. I hope you have found this information useful.

About the Author

Vipul Patel is a technology geek based in Seattle. He can be reached at vipul.patel@hotmail.com. You can visit his LinkedIn profile at https://www.linkedin.com/pub/vipul-patel/6/675/508.

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read