Tuesday 20 January 2015

What is XAML?

XAML is an Extensible Application Markup Language used for developing UI for .Net Framework Application. It is pronounced as "Zemmal". It is declarative markup language. It firstly comes with WPF(Windows Presentation Form). You can create visible elements using declarative statements in XAML. It is just another way to create visual presentation for the application instead of writing code in languages like C# etc. It usually comes with pair of tags i.e. every starting tag should have ending tag just like in writing HTML. You can also use Microsoft Expression blend to write XAML code. The XAML file creates the interface with all its elements and a code file behind it manages all events triggered by the elements.

Syntax of XAML


<Grid>
       <Textblock Margin="60">
              I 'm simple example of XAML.
       </Textblock>
</Grid>

Why Use XAML?


  1. It uses for separation of front end UI from back end coding i.e. Separation of design and logic.
  2. It's code is short as compared to C# code and easy to read.

Attributes Syntax

<Button Content="Click me" Background="Orange" Name="myButton" Click="myButton_click" />

Properties Syntax

<Button>
       <Button.Content>
              Click Me
       </Button.Content>

       <Button.Background>
              <SolidColorBrush color="Orange" />
       </Button.Background>
</Button>


1 comment:

  1. Its great very helpful for beginners as well other too.

    ReplyDelete