如何创建 WPF 圆角容器? [英] How do I create a WPF Rounded Corner container?

查看:39
本文介绍了如何创建 WPF 圆角容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在创建一个 XBAP 应用程序,我们需要在单个页面的各个位置都有圆角,并且我们希望有一个 WPF 圆角容器来放置一堆其他元素.有没有人对我们如何最好地实现这一目标有一些建议或示例代码?是使用样式还是创建自定义控件?

We are creating an XBAP application that we need to have rounded corners in various locations in a single page and we would like to have a WPF Rounded Corner container to place a bunch of other elements within. Does anyone have some suggestions or sample code on how we can best accomplish this? Either with styles on a or with creating a custom control?

推荐答案

你不需要自定义控件,只需将你的容器放在一个边框元素中:

You don't need a custom control, just put your container in a border element:

<Border BorderBrush="#FF000000" BorderThickness="1" CornerRadius="8">
   <Grid/>
</Border>

您可以将 替换为任何布局容器...

You can replace the <Grid/> with any of the layout containers...

这篇关于如何创建 WPF 圆角容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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