6 _ panel and border control usage for Silverlight with interconnected power

Source: Internet
Author: User

This chapter introduces the container controls used for layout. If you do not know the basic concepts of Silverlight, refer to the related content of Internet power.

Silverlight panel
Panel has three common forms for different la s:
Stackpanel: horizontal and vertical arrangement of child elements
Wrappanel: child element levels and vertical arrangement, line feed display
Dockpanel: Align elements to the edge of the container
Wrappanel and dockpanel are used on Silverlight toolkit.

Panel has the background attribute. You can use a brush to define the background color. The Code is as follows: panel1.background = new solidcolorbrush (colors. aliceblue); written in XAML: <stackpanel X: Name = "Panel1" background = "# FFFF00"/>. Please note that there is another way to write this:

Figure 1

If you think this is too much trouble and there is no need at all, you will be wrong. You can use composite attributes to achieve multiple colors, such as gradient effects. For specific examples, refer to the resource of XAML.

Silverlight border

Panel can be a container with a background color, but no border. This requires the border control, which has common attributes: Background color, borderbrush border brush, borderthickness Border width, in pixels, cornerradius border rounded corner, and padding border spacing. The following small example adds a border to the button. It is clear that the border control is not only a stroke, but also a container control.

First, place a button control on the page, for example, <button X: name = "btn1" content = "click" margin = "10" width = "100" Height = "40"/>. Use the button as a sub-element and place it in border, the complete content is as follows:

Figure 2

Running effect:

Figure 3

Let's talk about this today. Next time, let's talk about the usage of each panel.

Copyright Internet power, from: http://www.foxitjob.com/2010/07/343.html

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.