Type Converters

Chapter 1, “What Is XAML?” showed the following Button with two properties set using property attributes:

<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  Content="Stop" Background="Red"/>

and using property elements:

<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">  <Button.Content>    Stop  </Button.Content>  <Button.Background>    Red  </Button.Background></Button>

Let’s look at the equivalent C# code, in the context of Windows Store and universal apps:

Windows.UI.Xaml.Controls.Button b = new Windows.UI.Xaml.Controls.Button();b.Content = "Stop";b.Background = new Windows.UI.Xaml.Media. ...

Get XAML Unleashed 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.