Elements and Attributes
The XAML specification defines rules that map object-oriented namespaces, types, properties, and events into XML namespaces, elements, and attributes. You can see this by examining the following simple XAML snippet that declares a Button
control and comparing it to the equivalent C# code:
XAML:
<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Content="Stop"/>
C#:
Windows.UI.Xaml.Controls.Button b = new Windows.UI.Xaml.Controls.Button(); b.Content = "Stop";
Declaring an XML element in XAML (known as an object element) is equivalent to instantiating the corresponding object via a default constructor. Setting an attribute on the object ...
Get Universal Windows® Apps with XAML and C# 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.