WPF 布局WrapPanel使用案例

一、WrapPanel

自动换行布局

<Window x:Class="WpfAppNet8.Panel.WrapPanel1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfAppNet8.Panel"
        mc:Ignorable="d"
        Title="WrapPanel1" Height="450" Width="800">
    <WrapPanel>
        <Button Content="测试001" Width="100" Height="100"></Button>
        <Button Content="测试001" Width="200" Height="100"></Button>
        <Button Content="测试001" Width="100" Height="100"></Button>
        <Button Content="测试001" Width="200" Height="100"></Button>
        <Button Content="测试001" Width="100" Height="100"></Button>
        <Button Content="测试001" Width="200" Height="100"></Button>
        <Button Content="测试001" Width="100" Height="100"></Button>
    </WrapPanel>
</Window>

展示结果:

 

更多:

WPF 布局StackPanel使用案例

 WPF 布局Grid使用案例

 WPF 布局整理

posted @ 2025-06-28 14:36  天马3798  阅读(28)  评论(0)    收藏  举报