#66 – XAML Elements Map to Instances of .NET Types

As with XML, an element in XAML is a chunk of XAML that is enclased by angle brackets (<, >).  The element may consist of both a start tag and and end tag  (e.g. <Button></Button>) or an empty-element tag (e.g. <Button/>).

The text in the start tag, immediately following the left angle bracket (<) is known as the element name.

In XAML, this element name is the name of a .NET type and the XML element is known as an object element.

A object element in XAML represents an instance of a .NET class.  At run-time, a new instance of a .NET type will be created for each object element found in a .xaml file.

For example, the follow XAML fragment defines three object elements of type Button.

        <Button Content="Top" Height="23" Name="button1" Width="75" />
        <Button Content="Middle" Height="23" Name="button2" Width="75" />
        <Button Content="Bottom" Height="23" Name="button3" Width="75" />

At run-time, three instances of the Button type will be created when this XAML fragment is loaded.

(Faster processors will shorten job processing times)


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: