multiple geometry clips on a UIElement

落爺英雄遲暮 提交于 2019-12-11 14:55:09

问题


I am using C#, Silverlight, Visual Studio for Windows Phone 7.

Is there a way to give a UIElement multiple Geometry clips? Something equivalent to:

Path myPath = new Path();
myPath.Data = myRectangle; // say of size 100x100
myPath.Clip = myClipRect; // smaller rectangle, say of size 20x20, located at (0,0)
myPath.Clip = myClipEllipse; // circle of radius 30, centered on myRectangle

Right now, myClipEllipse will override myClipRect in myPath.Clip, so only myClipEllipse will be displayed. I'm looking for a result that draws myRectangle with both of these clips correctly (ie, not inverted).


回答1:


I ended up solving this using a GeometryGroup class (docs here). Just put all the geometries as children of the GeometryGroup, and give this GeometryGroup to the Clip.



来源:https://stackoverflow.com/questions/12896493/multiple-geometry-clips-on-a-uielement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!