WrapPlane面板在可能的空间中,以一次一行或一列的方式布置控件。
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Border Margin="10" Padding="20" Background="Aqua" BorderBrush="Black" CornerRadius="5"> <WrapPanel> <Label>123</Label> <Button Margin="5" MinWidth="100" MaxWidth="300">btn1</Button> <Button Margin="5" MinWidth="100" MaxWidth="300">btn2</Button> <Button Margin="5" MinWidth="100" MaxWidth="300">btn3</Button> </WrapPanel> </Border> </Window>