WPF布局之StackPanel

|------------------------------------------------|
| 一般用于修饰部分空间的元素排布,默认垂直排布,可通过属性Orientation,修改排列方式 |

cs 复制代码
<Window x:Class="Wpf_LayoutGrid.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:Wpf_LayoutGrid"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <!--设置行列数量和宽度高度,高度可以设置成比例、绝对值和auto自适应-->
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
         <!--默认垂直排序,通过属性Orientation修改排列方式-->
        <StackPanel Orientation="Horizontal">
            <Button Width="100" Height="40"/>
            <Button Width="100" Height="40"/>
            <Button Width="100" Height="40"/>
            <Button Width="100" Height="40"/>
        </StackPanel>

    </Grid>
</Window>
相关推荐
Scout-leaf11 天前
WPF新手村教程(三)—— 路由事件
c#·wpf
柒.梧.13 天前
基于SpringBoot+JWT 实现Token登录认证与登录人信息查询
wpf
十月南城16 天前
Flink实时计算心智模型——流、窗口、水位线、状态与Checkpoint的协作
大数据·flink·wpf
听麟18 天前
HarmonyOS 6.0+ 跨端会议助手APP开发实战:多设备接续与智能纪要全流程落地
分布式·深度学习·华为·区块链·wpf·harmonyos
@hdd18 天前
Kubernetes 可观测性:Prometheus 监控、日志采集与告警
云原生·kubernetes·wpf·prometheus
zls36536519 天前
C# WPF canvas中绘制缺陷分布map
开发语言·c#·wpf
专注VB编程开发20年19 天前
c#Redis扣款锁的设计,多用户,多台电脑操作
wpf
闲人编程20 天前
定时任务与周期性调度
分布式·python·wpf·调度·cron·定时人物·周期性
zls36536520 天前
C# WPF canvas中绘制缺陷分布map并实现缩放
开发语言·c#·wpf
数据知道21 天前
PostgreSQL:Citus 分布式拓展,水平分片,支持海量数据与高并发
分布式·postgresql·wpf