Monday, December 8, 2014

XAML Introduction


Introduction

  • XAML stands for eXtensible Application Markup Language.

  • The XAML language is fundamentally based on the XML language.
  • Great useful for XAML is serialize object. 

  • XAML is a machine language, readable and its a Compiled file.
  • XAML as a language is case-sensitive.

  • In XAML each element represented as an object.

  • Attributes represent properties or events.


Syntax :


Declarative :

<Button Content="Click Me!" Width="100" Height="50" Background="Green"/>

In CodeBehind :

Button b=new Button();

b.Width=100;
b.Height=50;
b.Content="Click Me!";
b.Background=new SolidColorBrush(Colors.Green);


Storyboard In XAML

  • Container timeline provides object and property targeting information for its child animation.
  • In Storyboard we are using DoubleAnimation and ColorAnimation Class for animation.


  • DoubleAnimation :
    • Animates the value of a Double property between two target values using To and From properties in a specified duration

Syntax:



<Storyboard x:Name=”storyboard1” >

<DoubleAnimation Duration=”0:0:1” To=”0.0” From=”1.0” Storyboard.TargetProperty=”Opacity” Storyboard.TargetName=”rectangle1” />

</Storyboard>

  • ColorAnimation :
    • Animates the value of a Color property between two target values using To and From properties in a specified duration
Syntax:

<Storyboard x:Name=”storyboard1” >
<ColorAnimation Duration=”0:0:1” To=”Green” From=”Red” Storyboard.TargetProperty=”Color” Storyboard.TargetName=”mySolidColorBrush” />
</Storyboard>









No comments:

Post a Comment