WPF:带有列/行边距/填充的网格? [英] WPF: Grid with column/row margin/padding?

查看:17
本文介绍了WPF:带有列/行边距/填充的网格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以轻松地为 WPF 网格中的行或列指定边距和/或填充?

我当然可以添加额外的列来分隔内容,但这似乎是填充/边距的工作(它会给更多更简单的 XAML).是否有人从标准网格派生来添加此功能?

I could of course add extra columns to space things out, but this seems like a job for padding/margins (it will give much simplier XAML). Has someone derived from the standard Grid to add this functionality?

推荐答案

您可以编写自己的 GridWithMargin 类,继承自 Grid,并覆盖 ArrangeOverride 应用边距的方法

You could write your own GridWithMargin class, inherited from Grid, and override the ArrangeOverride method to apply the margins

这篇关于WPF:带有列/行边距/填充的网格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆