📜  XAML-布局

📅  最后修改于: 2020-11-18 10:31:33             🧑  作者: Mango


控件的布局对于应用程序可用性非常重要且至关重要。需要在您的应用程序中安排一组GUI元素。选择布局面板时,需要考虑某些重要点;

  • 子元素的位置。
  • 子元素的大小。
  • 重叠的子元素彼此层叠。

当在不同屏幕分辨率下使用应用程序时,控件的固定像素排列不起作用。 XAML提供了一组丰富的内置布局面板,以适当的方式排列GUI元素。一些最常用和流行的布局面板如下-

Sr.No Panels & Description
1 StackPanel

Stack panel is a simple and useful layout panel in XAML. In a stack panel, child elements can be arranged in a single line, either horizontally or vertically, based on the orientation property.

2 WrapPanel

In WrapPanel, child elements are positioned in a sequential order from left to right or from top to bottom based on the orientation property.

3 DockPanel

DockPanel defines an area to arrange child elements relative to each other, either horizontally or vertically. With DockPanel, you can easily dock child elements to top, bottom, right, left, and center with Dock property.

4 CanvasPanel

Canvas panel is the basic layout panel in which child elements can be positioned explicitly using coordinates that are relative to the Canvas any side such as left, right, top, and bottom.

5 GridPanel

A Grid panel provides a flexible area which consists of rows and columns. In a Grid, child elements can be arranged in a tabular form.