Monday, June 17, 2013

What is XAML :

Xaml is pronounced as 'zaemal'.XAML stands for Extensible Application Markup Language. It is a Markup Language built using XML ,which is used to create rich User Interface, eventing and data binding.It has a very rich set of styling elements.Today XAML is the markup language for many technologies like WPF,Silverlight and Windows Store Apps. XAML files are xml files which are  represented in texts and have the extension name 'xaml' . Xaml files can be created and edited by tools like Microsoft Expression Blend,Microsoft Visual Studio.

Root elements and Namespaces..

A Xaml file as said before is a xml file can have only one root element .The Root elements can be a Page,Window and ResourceDictionary or and Application.
The root elements contains the attribute xmlns. This attribute indicate to a xaml processor which XAML namespaces contain the type definitions for backing types that the markup will reference as elements. This attribute is used to specify the namespaces with in the xaml file
For example

</page>

here xmlns: specifies the default xaml namespace.With in the default xaml namespaces,object elements in the markup can be specified with out a prefix.The xmlns:controls attribute indicates and additional xaml namespace that maps xaml language namespace.
xmlns attributes are strictly necessary on the root element of each XAML file. The xmlns definitions will be applied to all the descendant elements of the root element. The xmlns attributes are also permitted on other elements underneath the root and would apply to any descedant elements of the difining element ,but this should be avoided as the redifition of xaml namespaces can result in a xaml markup style that is difficult to read.

The x: Prefix :
The x: prefix is used for mapping the xaml namespaces in the templates for projects.
Some common x: prefix programming constructs are x:key,x:class,x:name,x:static,x:type..