Logo 
Search:

WPF Articles

Submit Article
Home » Articles » WPF » XAMLRSS Feeds

Stack Panel Layout in XAML

Posted By: Vivek Patel     Category: WPF     Views: 12453

This article will explain Stack Panel Layout in XAML. A very simple tutorial to understand Stack Panel Layout in XAML.

Understanding Stack Panel Layout

  • Lays out element by stacking them one after the other. 
  • Items can either be stacked vertically or horizontally.  By default items are stacked vertical.
  • Thus stack panel control is used in positioning control in either a row or column format.
  • They are mostly used to arrange a small subsection of UI.

Example of Stack Panel Layout

Note: By Default Items in Stack Panel are aligned Vertically

In following example we are using 4 Label controls.  You would see that output is aligned vertically.

<StackPanel>            
    <Label Content="Stack Panel Demo" 
            FontSize="15" FontWeight="Bold"
            Foreground="Blue"/>

    <Label Content="Label1" FontSize="15" FontWeight="Bold" />
    <Label Content="Label2" FontSize="15" FontWeight="Bold" />
    <Label Content="Label3" FontSize="15" FontWeight="Bold" />
</StackPanel>   

Output of Stack Panel Layout
  
Share: 

 
 

Didn't find what you were looking for? Find more on Stack Panel Layout in XAML Or get search suggestion and latest updates.

Vivek Patel
Vivek Patel author of Stack Panel Layout in XAML is from United States. Vivek Patel says

I have started working in .Net Technology since its beta release and lucky to got chance to work on .Net 1.1, 2.0 and now working on .Net 3.5. I have worked in both C# and VB.Net for Asp.net Projects. I can also provide Sharepoint development needs. I can efficiently switch role from Tech Lead and Developer. I have comprehensive knowledge of Asp.net Development. I have been award Microsoft Most Valuable Award twice in Asp.net Technology.

Blog: http://dotnetguts.blogspot.com

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!