Play with the Silverlight control (iii)--stackpanel layout

Source: Internet
Author: User
Tags silverlight

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.