WPF Container Control

Source: Internet
Author: User

, Or By providing the built-in layout function, container controls allow you to quickly design a variety of effective user interfaces. Each container control processes the layout and location of its contained controls, and can provide attributes that help to be located to the contained controls. This topic provides an overview of different types of container controls and how these container controls affect the layout of the included controls.

Grid

The most familiar container control is Control. By default Contains Control. Allows you to place controls in user-defined cells. For controls placed in cells The margin between two or more control edges and cell edges remains unchanged. For more information about how to set margins, see How to: Set control margins in the WPF Designer.

Add Medium, Controls include a single cell. You can add more Verticals and parallelism to the Code or the WPF Designer. For more information, see How to: Add rows and columns to a grid.

Uniformgrid

Controls provide a simplified grid layout for controls. When the control is added They are arranged in a grid mode, and the grid mode is automatically adjusted to keep the distance between controls even. The number of cells is adjusted to adapt to the number of controls. For example, if four controls are added They are arranged in a grid containing four cells.

Canvas

Controls Support absolute positioning and provide the least built-in layout for the controls they contain. You can place the included controls at a certain offset from any corner of the Panel. Provides four attributes for the included controls: , , And . The control must specify a horizontal attribute and a vertical attribute, and specify the angle from which the control is to be deviated. For example, if a widget is And If the value is specified, the control remains unchanged from the upper right corner. If you specify values for multiple horizontal or vertical attributes, one of these values is ignored. For more information, see How to: create a layout based on absolute positioning.

Stackpanel

You can either vertically stack the contained controls or arrange the included controls in the horizontal row. The actual situation depends on Attribute Value. If And add Multiple widgets to .

Wrappanel

In To vertically stacked controls or place controls in rows, And Similar. In addition to stacked, It also provides line feed support for included controls. Therefore, if And add Multiple widgets to .

Dockpanel

Provides dock support so that the toolbar or other widgets on the Panel can be easily located. The control provides a dockstyle attribute to the contained control, which determines the Positioning Method of the contained control. For example, the control with the dockstyle attribute set to dockstyle. Top is docked Top. A . When this attribute is true, add The last child control in will automatically set its dockstyle attribute to true.

The above is transferred from the"WPF container controls

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.