Panel

The Panel is the base class for controls that can contain multiple children like DockPanel or StackPanel.

The Panel class can be useful on its own for very basic layouts, or simply to allow multiple controls to be to be contained.

<Panel Height="300" Width="300">
    <Rectangle Fill="Red" Height="100" VerticalAlignment="Top"/>
    <Rectangle Fill="Blue" Width="100" HorizontalAlignment="Right" />
    <Rectangle Fill="Green" Height="100" VerticalAlignment="Bottom"/>
    <Rectangle Fill="Orange" Width="100" HorizontalAlignment="Left"/>
</Panel>

There are other more useful panels that derive from Panel, these include:

StackPanelDockPanelRelativePanelWrapPanel

Reference

Panel

Source code

Panel.cs

面板概述创建自定义面板

最后更新于