Phân bổ toàn bộ lợi thế của khu vực bảng điều khiển để mỗi đứa trẻ, hữu ích để xác định cách bố trí sơ bộ ứng dụng đơn giản ở quy mô thô. Sắp xếp trẻ em trong một lưới điện, hữu ích cho việc xếp thẳng hàng mà không phải dùng đến kích thước và vị trí cố định. | Table 3-1. Main panel types Panel type StackPanel Usage Lays children out in a vertical or horizontal stack extremely simple useful for managing small-scale aspects of layout. WrapPanel DockPanel Lays children out from left to right moving onto a new line each time it fills the available width. Allocates an entire edge of the panel area to each child useful for defining the rough layout of simple applications at a coarse scale. Grid Arranges children within a grid useful for aligning items without resorting to fixed sizes and positions. The most powerful of the built-in panels. Canvas Performs no layout logic puts children where you tell it to allows you to take complete control of the layout process. UniformGrid Arranges children in a grid where every cell is the same size. By default panels have no appearance of their own the only visible effect of their presence being how they size and position their chil-jM dren. However they can be made visible by setting their Background property. We ll start with one of the most basic panels StackPanel. StackPanel StackPanel is a very simple panel that arranges its children in a row or a column. You will not normally use StackPanel to lay out your whole user interface. It is most useful for arranging small subsections. Example 3-1 shows how to build a simple search user interface. Example 3-1. StackPanel search layout StackPanel Background ECE9D8 TextBlock Margin 3 Look for TextBlock ComboBox Margin 3 TextBlock Margin 3 Filtered by TextBlock ComboBox Margin 3 Button Margin 3 5 Search Button CheckBox Margin 3 Search in titles only CheckBox CheckBox Margin 3 Match related words CheckBox CheckBox Margin 3 Search in previous results CheckBox CheckBox Margin 3 Highlight search hits in topics CheckBox StackPanel Figure 3-1 shows the results. As you can see the UI elements have simply been stacked vertically one after another. This example used the Margin property to space the elements out a little. Most elements use a single .