Wednesday, 31 December 2014

Tree structure present in XAML

In this post we can see XAML. XAML is an XML based mark up language. For specifying the settings and characteristics of a class. It is concentration mainly in the UI presentation and some part of animation along with binding.

C# is used for control the flow of XAML and specifying the Behavior of XAML tag.It consists of two kind of Trees to represent the elements. First is Logical Tree and Visual Tree.

Logical Tree means comprises the elements as they listed in the XAML.

Visual Tree means includes the parts of all things that is used to visualize the control and parts like border of a control , presenter


For Example Let we take the below syntak.

<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <Button>Click Me</Button>
    </StackPanel>
</Window>



From the XAML Code now we are going to define the Logical tree and visual tree.

Logical Tree: Specifies only the element present in the XAML

              Window 
                    |
            StackPanel
                    |
               Button


Visual Tree: Includes all things which are useful in display the controls.

             Window 
                    |
               Border
                   |
       AdornerDecorter
                    |
       ContentPresenter
                    |
            StackPanel
                    |
               Button
                    |
            ContentPresenter

From the above you can learn some basic things about Tree structure present in XAML.
             

No comments:

Post a Comment