xaml - 如何在Windows Store App中裁剪带有圆角的内容

标签 xaml windows-store-apps winrt-xaml rounded-corners clipping

我已经尝试过使用<Grid/>(内部具有交互式内容,而不仅仅是图像)裁剪了带有圆角的(可以使用<Border/><Rectangle/>进行任何操作)。

我尝试了多种解决方案,但没有一个与Windows Store App兼容。

无刷:

  • RadialGradientBrush is not supported in a Windows App project.
  • DrawingBrush is not supported in a Windows App project.
  • The type 'VisualBrush' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.


没有面具:

  • The attachable property 'OpacityMask' was not found in type 'Image'.
  • The attachable property 'OpacityMask' was not found in type 'StackPanel'.
  • The attachable property 'OpacityMask' was not found in type 'Grid'.


无圆角几何:

  • The property 'RadiusX' was not found in type 'RectangleGeometry'.
  • MultiBinding is not supported in a Windows App project.


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

最佳答案

您是否尝试过将控件置于边界内?只需将边框的拐角半径设置为150,您就可以实现完美的圆形控制。这是一个带有按钮的示例。

    <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>

关于xaml - 如何在Windows Store App中裁剪带有圆角的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16341788/

相关文章:

xaml - 如何将命令添加到 ListBox.ItemTemplate

c# - WPF 矩形边框与两条破折号的连接线的角

c# - 将像素着色器应用于图像

xaml - 相当于 WinRT 中的可编辑组合框?

design-patterns - MVVM View 模型和异步数据初始化

xml - StandardStyles 中的 "&#xE100"值

WPF 元素绑定(bind)在 XAML 中不起作用

c# - 如何在windows store app中设置HttpRequest的Referer?

data-binding - Windows 8 Metro 应用程序 Collection View 源数据绑定(bind)问题

visual-studio-2013 - XAML 设计器错误 - 缺少智能感知