In the last article, we introduced the layout of the canvas. We also know that there are three canvas,stackpanel,grid layouts in Silverlight, and today we're going to talk about the layout of StackPanel.
Stack, Stacks! This word is familiar to us all. However, an advanced data structure. I think it's a metaphor for the way we look in this layout. Oh, I'll talk about this later.
StackPanel actually looks like a flowlayout, stream layout in the Java GUI.
Let's take a look at an example:
<StackPanel Background="White">
<Button Content="AAA"></Button>
<Button Content="BBB"></Button>
</StackPanel>
The effect is as follows:
Do you remember FlowLayout?
Let's look at the default layout method:
1. By default, is the horizontal layout. Like a stack at the bottom of a stack, do we keep each control in a constant pressure?
2. By default, it is stretch, or stretching, that fills our control screen.
Okay, so how do we change.
First of all, let's change the horizontal layout to a vertical layout.
<StackPanel Background="White" Orientation="Horizontal">
<Button Content="AAA"></Button>
<Button Content="BBB"></Button>
</StackPanel>
The effect is as follows: