Skip to main content

Microsoft Silverlight

Answered Question There isn't Clip to bounds option?RSS Feed

(0)

sinosoidal
sinosoidal

Member

Member

664 points

373 Posts

There isn't Clip to bounds option?

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 

--

Imagining (and touching) the future
http://www.nunosantos.net/
http://www.myspace.com/sinosoidal

Yi-Lun Luo - MSFT
Yi-Lun L...

All-Star

All-Star

25052 points

2,747 Posts

Re: There isn't Clip to bounds option?

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.

shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.

sinosoidal
sinosoidal

Member

Member

664 points

373 Posts

Re: There isn't Clip to bounds option?

Hi,

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?

Thx,

Nuno 

--

Imagining (and touching) the future
http://www.nunosantos.net/
http://www.myspace.com/sinosoidal

sinosoidal
sinosoidal

Member

Member

664 points

373 Posts

Answered Question

Re: There isn't Clip to bounds option?

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
 

--

Imagining (and touching) the future
http://www.nunosantos.net/
http://www.myspace.com/sinosoidal

moemeka
moemeka

Member

Member

147 points

69 Posts

Re: There isn't Clip to bounds option?

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.

Please mark as answered if this post resolves your issue.

http://moemeka.blogspot.com
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities