如何在 Windows 应用商店应用中使用圆角剪辑内容 [英] How to Clip content with rounded corners in Windows Store App

查看:72
本文介绍了如何在 Windows 应用商店应用中使用圆角剪辑内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用圆角剪裁<Grid/>(里面有交互式内容,而不仅仅是一张图片)剪裁(一个<Border/><Rectangle/>,不管怎样都行).

I've attempted to have a <Grid/> (with interactive stuff inside, not just an image) clipped with rounded corners (a <Border/> or a <Rectangle/>, whatever works).

我尝试了多种解决方案,但没有一个与 Windows 应用商店应用兼容.

I've attempted multiple solutions, but none of them was compatible with a Windows Store App.

无刷:

  • Windows 应用项目不支持 RadialGradientBrush.
  • Windows 应用项目不支持DrawingBrush.
  • 未找到VisualBrush"类型.确认您没有丢失程序集引用并且所有引用的程序集都已构建.

没有面具:

  • 在图像"类型中找不到可附加属性OpacityMask".
  • 在StackPanel"类型中找不到可附加属性OpacityMask".
  • 在网格"类型中找不到可附加属性OpacityMask".

没有圆形几何:

  • 在RectangleGeometry"类型中找不到属性RadiusX".
  • Windows 应用项目不支持多重绑定.

在 C#/XAML Windows 商店应用程序中,这在技术上是不可能的吗?

Is it something technically impossible in a C#/XAML Windows store app?

推荐答案

您是否尝试过将控件置于边框内?只需将边框的圆角半径设置为 150 即可获得完美的圆形控件.这是一个带有按钮的示例.

Have you tried putting your control inside a border? Just set the border's corner radius to 150 and you have a perfectly round control. Here's an example with a button.

    <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Center"  Height="200" Margin="0,0,0,0" VerticalAlignment="center" Width="200" CornerRadius="150">

        <Button x:Name="btnPlayback" Content="Play" HorizontalAlignment="Center" Height="200" Margin="0,0,0,0" VerticalAlignment="center" Width=" 200" BorderThickness="0"  Click="btnPlayback_Click_1"/>

    </Border>

这篇关于如何在 Windows 应用商店应用中使用圆角剪辑内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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