Skip to main content
Home Forums Silverlight Design Designing with Silverlight There isn't Clip to bounds option?
4 replies. Latest Post by moemeka on July 4, 2009.
(0)
sinosoidal
Member
664 points
373 Posts
03-30-2008 2:26 PM |
Hi,
I was trying to implement an idea but it depends on clip to bounds. There isn't clip to bounds on Silverlight?
Thx,
Nuno
Yi-Lun L...
All-Star
25052 points
2,747 Posts
03-31-2008 11:25 PM |
Hello, in WPF, only Canvas respects the ClipToBounds property. Any other Panels just always clip their children no matter what value ClipToBounds has. In Silverlight, while the ClipToBounds property is missing, the only limitation I can think is you can't turn on ClipToBounds on Canvas. The Canvas will never clip its children. If you want other Panels not to clip your UIElement, you can wrap it into a Canvas, as we do in WPF.
04-01-2008 12:15 PM |
I can't verify what you have just told me.
I have items inside an element which isn't a Canvas and their are not being clipped when translated out of the bound of the parent.
Any tips?
04-02-2008 5:48 AM |
I found that in order to have the content clipped i had to define a geometry in the clip property of the container that i need that to happen.
<Grid.Clip> <RectangleGeometry x:Name="clipGeometry" /></Grid.Clip>
clipGeometry.Rect = new Rect(0,0,100,100);
I named the geometry in order to make it customizable in real time.
Thx anyway,
moemeka
147 points
69 Posts
07-04-2009 10:58 AM |
sinosoidal: Hi, I found that in order to have the content clipped i had to define a geometry in the clip property of the container that i need that to happen. <Grid.Clip> <RectangleGeometry x:Name="clipGeometry" /></Grid.Clip> clipGeometry.Rect = new Rect(0,0,100,100); I named the geometry in order to make it customizable in real time. Thx anyway, Nuno
HI, the problem with that approach is that you have to always know the layout size of the Panel. If you want the automated clip to bounds style functionality, wrap the panel in a scroll viewer (remove the padding and scroll visibility to make it non visible to your user). I have found that this works the best.