For example: I have a standard single-cell mesh and a control inside it (say, a button). When I move a button inside a cell, it is displayed, and if I move outside, it is not displayed, well, or, accordingly, it is partially displayed. And now it is displayed incorrectly - when I move this button, it goes outside the cell and overlaps other elements. How can I avoid this?

  • What, nobody knows? - LackOfKnowledge

2 answers 2

In Silverlight, all UIElements have a Clip property, use something like this:

<Grid Width="200" Height="100"> <Grid.Clip> <RectangleGeometry Rect="0, 0, 200, 100"/> </Grid.Clip> </Grid> 

To make it easier to work with it, you can write a behavior, read more here.

  • read better question and comments - LackOfKnowledge
  • This is me to the fact that ZIndex is almost everywhere. If you want the button to be cut off, then the ClipToBounds property will help you. - ArtFeel
  • yes this property is in WPF but not in Silverlight - LackOfKnowledge
  • Yes, really, then try this: scottlogic.co.uk/blog/colin/2009/05/… - ArtFeel
  • one
    Thanks, I didn’t read the whole article, but the Clip property helped me, so if I correct your answer, I’ll put it credited - LackOfKnowledge

Try using z-order. It all depends on what element you added before. You can also manually assign the z-index of each item.

  • There is no z-index, and besides, it would just help to avoid overlapping other elements, and I need it not to be displayed outside the grid. - LackOfKnowledge
  • Z-index is almost everywhere. - Nicolas Chabanovsky
  • practically does not count tinypic.ru/?do=view&pic=20110428211148_394.png - LackOfKnowledge