在 WPF 中调整窗口大小时调整剪切路径的大小
我想知道如何在调整窗口大小时动态调整剪切路径的大小。现在,我在 Expression Blend 中选取一个随窗口调整大小的矩形。将此矩形应用到圆形作为剪切路径会使矩形固定,并且不会再调整大小。
我已经在 XAML 中的 Clip="" 属性以及样式标记中看到了创建剪切路径的不同方法。但我还没有成功找到合适的 XAML 解决方案。
有人能指出我正确的方向吗?
谢谢!
I was wondering how to resize a Clipping path dynamically when resizing the window. Right now I'm taking a rectangle in Expression Blend that resizes with the window. Applying this rectangle to a circle as a clipping path makes the rectangle fixed, and it won't resize anymore.
I've seen different ways of making clipping paths in XAML, in the Clip="" property as well as style markup. But I haven't succeeded yet in finding a proper XAML solution.
Can anyone point me in the right direction?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在寻找同一问题的答案(这就是我找到你的帖子的方式),我发现了这个:
http://chriscavanagh.wordpress.com/2008/10/03/wpf-easy-rounded-corners-for-anything/
不确定如果您有一个更复杂的形状想要用作剪切路径,它会为您工作,但如果您只是想圆化一些会自动缩放的角,我建议您检查一下。它使用绑定到边框元素的 VisualBrush 而不是剪切路径。到目前为止,我发现它是满足我需求的非常优雅的解决方案。
I was searching for an answer to the the same question (that's how I found your post) and I came across this:
http://chriscavanagh.wordpress.com/2008/10/03/wpf-easy-rounded-corners-for-anything/
Not sure it will work for you if you have a more complex shape that you would like to use as the clipping path, but if you are just looking to round some corners that will scale automatically, I suggest you check it out. It uses a VisualBrush bound to a border element instead of a clipping path. So far I have found it to be a pretty elegant solution for my needs.