XAML Layout Part Two - StackPanels

Well in the previous post I talked about Grids, rows and columns so in this post I will talk about stackpanel and it is orientation and alignment.
So let’s start.

StackPanels:

Stackpanels are pretty simples they just allow you to arrange objects next to each others vertically or horizontally.
So stackpanel think of it like things stacked up either from top to bottom or from left to right.
 

So in this picture we have a stackpanel that have a couple of rectangles in it.
It is orientation is horizontal that’s mean we will start from right lo left so the first rect (Rectangle) with the color red will be in the right and the second one with the aqua color will be next to it and so on so forth. That will give you this layout in your designer.
 

here we have another stackpanel with four rect in it and its orientation is vertical that’s basically mean set these rect from top to bottom.


so the code above will give you the next layout in your designer.


 You can also put stackpanels inside another stackpanel.
I hope you get it.it is pretty easy.

 

Next PostNewer Post Previous PostOlder Post Home

0 comments:

Post a Comment