Understanding XAML

XAML can be used to create:

  • UWP apps for Windows 10
  • Windows Store apps for Windows 8 and 8.1
  • Windows Presentation Foundation (WPF) applications for the Windows desktop, including Windows 7 and later
  • Silverlight applications for web browsers, Windows Phone, and desktop

    Note

    Although Silverlight is still supported by Microsoft, it is not being actively developed, so it should be avoided.

Simplifying code using XAML

XAML simplifies C# code, especially when building a user interface.

Imagine that you need two or more buttons laid out horizontally to create a toolbar. In C#, you would write this code:

var toolbar = new StackPanel(); toolbar.Orientation = Orientation.Horizontal; var newButton = new Button(); newButton.Content = "New"; newButton.Background ...

Get C# 6 and .NET Core 1.0: Modern Cross-Platform Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.