top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is XAML?Explain with example?

+1 vote
297 views
What is XAML?Explain with example?
posted May 11, 2015 by Karthi Kumar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

XAML stands for eXtended Application Markup Language. XAML contains XML that is used to declaratively specify the user interface for Silverlight or WPF applications.

For example, if you need to display a rectangle, this is the XAML you need to use:

<UserControl x:Class="SilverlightApplication1.SilverlightControl1" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  Width="400" Height="300">
    <Canvas Width="500" Height="500" Background="White">
        <Rectangle Canvas.Left="75" Canvas.Top="90" 
                  Fill="red" Width="100" Height="100" />
    </Canvas>
</UserControl>

Output:

enter image description here

When the above XAML is executed, it will display a rectangle filled with red color. You may notice that XAML is very similar to HTML in nature.

XAML stands for eXtensible Application Markup Language, and is a declarative markup language that follows the XML rule and is used for developing User Interfaces in WPF and Silverlight technology. XAML files are XML files that generally have the .xaml extension, and separates the UI definition from the run-time logic by using code-behind files, joined to the markup through partial class definitions.

XAML has a set of rules that map object elements into classes or structures, attributes into properties or events, and XML namespaces to CLR namespaces. XAML elements map to Microsoft .NET types as defined in referenced assemblies, and the attributes map to members of those types.

answer May 12, 2015 by Jdk
...