日常生活的交流与学习

首页 新随笔 联系 管理

StackPanel wpf 布局

GridDemo\GridDemo\MainWindow.xaml

<Window x:Class="GridDemo.MainWindow"
        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:GridDemo"
        mc:Ignorable="d"
        Title="MainWindow" Height="500" Width="800">
    <StackPanel>
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
    </StackPanel>
</Window>

<Window x:Class="GridDemo.MainWindow"
        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:GridDemo"
        mc:Ignorable="d"
        Title="MainWindow" Height="500" Width="800">
                          <!-- 👇 -->
    <StackPanel Orientation="Horizontal">
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
        <Button Width="100" Height="50" Content="Button" Background="Pink" />
    </StackPanel>
</Window>

posted on 2024-10-26 21:43  lazycookie  阅读(3)  评论(0编辑  收藏  举报