, 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