Developer's Academy: Introduction to XAML

Tuesday, 2 September 2014

Introduction to XAML

XAML - Basics

XAML is a little bit similar to the very popular markup language HTML. XAML is nothing but the EXtensible Markup Language XML. XML is also similar to HTML since both markup languages share some base common properties and tags. 



XAML is really just XML, the eXtensible Markup Language. At a higher level, XML looks like HTML insomuch that they share a common ancestry.

Whereas HTML is specific to structuring a web page document, XML is more generic. By "generic" I mean that you can use it for any purpose you devise and you can define the names of the elements and attributes to suit your needs.

In the past, developers have used XML for things like storing application settings, or using it as a means of transferring data between two systems that were never meant to work together. To use XML, you define a schema, which declares the proper names of elements and their attributes.

A schema is like a contract. Everyone agrees — both the producer of the XML and the consumer of the XML to write and read XML to conform to those rules, they’ll abide by that contract. Now, they can communicate with each other. So, a schema is an important part of XML. 

Example

This example presents how XAML looks and works.

<Button Name=”PlayAudioButton”
                          Width=”100”
                          Height=”70”
                          HorizontalAlignment =”Left”
                          VerticalAlignment =”Top”
                          Background = ”Green” 
                          Click =”PlayAudioButton_Click”> Play
</Button>


No comments:

Post a Comment