如何在Silverlight c#中以星形路径的形状剪辑网格?

时间:2013-04-25 15:06:15

标签: c# silverlight xaml windows-phone-8

我有Grid&amp; StarPath <Path x:Name="StarPath" Data="M213,135 L183,213 L87,246 L159,288 C159,288 140,372 140,375 C140,378 226,329 226,329 L303,367 L280,275 L316,216 L246,219" Fill="#FF0EB679" HorizontalAlignment="Left" Height="241.132" Margin="86.5,134.5,0,0" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" VerticalAlignment="Top" Width="230"/> <Grid HorizontalAlignment="Left" Height="300" Width="300" Background="#FFD11010"/> <br/><br/>

Grid in the shape of Star shaped Path

我想找到我的Clipping Grid by Path by Code
任何人都可以为{{1}}提供任何提示或样本吗?

1 个答案:

答案 0 :(得分:0)

您可以尝试调整this méthod ...

MyGrid.Clip = getPathGeometry(StarPath.Data.ToString());

你必须添加“||”如果测试,则按data = data.Replace("M", " M").Replace("C", " C").Replace("L", " L");

更改data.replace