c# - float 面板(与对齐重叠)

标签 c# wpf

是否有可能在 wpf 的面板中 float (与对齐重叠)子项? 我有 4 个相互重叠的按钮。它们需要向左、右、顶部和底部对齐,并与父容器一起增长。请查看图片了解更多信息。

enter image description here

最佳答案

这个怎么样?

<Grid>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Button Grid.Row="1" Grid.Column="0" Content="Left"/>
        <Button Grid.Row="1" Grid.Column="1" Content="Right"/>
    </Grid>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>

        <Button Grid.Row="0" Grid.Column="1" Content="Top"/>
        <Button Grid.Row="1" Grid.Column="1" Content="Bottom"/>
    </Grid>
</Grid>

结果是

enter image description here

关于c# - float 面板(与对齐重叠),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11064187/

相关文章:

C# 检查分割字符串的一个计数,如果正确则打印另一个计数

c# - 在生产网络服务器上执行流程

c# - 键盘事件问题

wpf - WPF应用程序的VNC控制

c# - 在 EPPLUS ExcelChart 中关闭圆角

WPF动画问题

c# - 使用 fluentmigrator 运行 sql 脚本

c# - 如何将源类型 'System.Nullable<bool>' 转换为目标类型 'bool'

c# - 在 C# 代码中更改 WPF 窗口背景图像

.net - 选择时更改 TreeViewItem 的模板