locked
ClipToBounds ... how does it work RRS feed

  • Question

  • I have a stackpanel where clipToBounds is set to false.. I have some items in the stackpanel where I animate the scale value ..

    But they get clipped by the stackpanels height when the get larger than the SP height .. shouldent clipTobounds fix this or what Am I doing wrong ??

    <
    StackPanel Width="500" Height="200" ClipToBounds="False" Orientation="Horizontal" Background="Transparent" x:Name="SP"></StackPanel>

     

    /Bo

    Friday, May 11, 2007 11:26 AM

Answers

  • Right - ClipToBounds="true" will apply an explicit clip, but ClipToBounds="false" doesn't prevent the underlying layout system from applying a clip when it determines that the child is larger than the parent.

    Friday, May 11, 2007 4:00 PM

All replies

  • You probably need to scale using a RenderTransform.

     

    A scale applied to the layout (LayoutTransform or setting Width/Height too large) will effectively be clipped by the layout process - which I dont think you can avoid.

    Friday, May 11, 2007 3:15 PM
  • Right - ClipToBounds="true" will apply an explicit clip, but ClipToBounds="false" doesn't prevent the underlying layout system from applying a clip when it determines that the child is larger than the parent.

    Friday, May 11, 2007 4:00 PM
  • I have the same problem, I have a use where if I simplify it, it's basically a bunch of horizontal stack panels organised vertically inside a parent stack panel, each child stack panel is to contain rectangles of varying size, almost all being a height larger than the stack panel. I don't want the par

    +--------------------+
    |                    |
    |+---+               |
    +|   |---------------+
    ||   |               |
    ||___|               |
    +--------------------+
    |                    |
    |                    |
    +--------------------+

    Canvas is one control that honors the property, though it seems no other containers seem to honor it. What's an alternative to my problem mentioned above?

    Thanks

    -Brett
    • Edited by Brett Ryan Thursday, August 28, 2008 8:31 AM Can't seem to get the fixed width fonts to work
    Thursday, August 28, 2008 8:09 AM
  • Is there still no solution for this?
    -Brett
    Tuesday, December 1, 2009 10:39 AM
  • Yes. 

    İf You Use a ViewBox and a Canvas on your user control will fix all the mainwindow sizes

       <Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">

      <canvas>

    --- all your controls -- 

         </Canvas>
            </Viewbox>

    Wednesday, May 15, 2019 9:49 AM