Silverlight Rounding Corners

Silverlight Rounding Corners,第1张

概述我有一个Grid,有各种子元素,如Grid,Stackpanel, Image ……是否有可能以一种裁剪所有内容的方式围绕网格的角落?此外,根网格的大小可能会有所不同,因此无法进行硬编码. 编辑:经过大量的搜索,我发现这个问题的最佳解决方案是使用@wdavo提取的ClippingBehavior,谢谢!真正的问题是不知道图像的尺寸.如果您知道尺寸,那么有很多简单的开箱即用解决方案. 您可以使用此剪 我有一个GrID,有各种子元素,如GrID,Stackpanel,Image ……是否有可能以一种裁剪所有内容的方式围绕网格的角落?此外,根网格的大小可能会有所不同,因此无法进行硬编码.

编辑:经过大量的搜索,我发现这个问题的最佳解决方案是使用@wdavo提取的ClipPingBehavior,谢谢!真正的问题是不知道图像的尺寸.如果您知道尺寸,那么有很多简单的开箱即用解决方案.

解决方法 您可以使用此剪切行为

http://expressionblend.codeplex.com/SourceControl/changeset/view/61176#494852

您需要安装Expression Blend SDK

<UserControlx:Class="RoundedCorners.MainPage"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/Expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:behaviors="clr-namespace:Expression.Samples.Interactivity"xmlns:i="clr-namespace:System.windows.Interactivity;assembly=System.windows.Interactivity"mc:Ignorable="d"d:DesignHeight="800"d:DesignWIDth="800"><GrID    x:name="LayoutRoot"    Background="White"    margin="50">    <GrID        Background="lightGreen">        <GrID.RowDeFinitions>            <RowDeFinition />            <RowDeFinition                Height="auto" />        </GrID.RowDeFinitions>        <i:Interaction.Behaviors>            <behaviors:ClipPingBehavior                CornerRadius="30" />        </i:Interaction.Behaviors>        <Image            GrID.Row="0"            Stretch="Fill"            Source="Image.JPG" />        <StackPanel            GrID.Row="1">            <TextBlock                Text="Hello" />            <TextBlock                Text="World" />        </StackPanel>    </GrID></GrID>
总结

以上是内存溢出为你收集整理的Silverlight Rounding Corners全部内容,希望文章能够帮你解决Silverlight Rounding Corners所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1007419.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存