locked
How do I enable a clipping path to resize? RRS feed

  • Question

  • I'd like to apply a clipping path to LayoutRoot Grid that resizes with LayoutRoot. It's easy enough to apply a clipping path however it becomes a fixed size even if both LayoutRoot and the shape are resizeable (using d:DesignWidth and Auto). Is there a way to make the clipping path change it's width when LayoutRoot changes?
    Monday, May 17, 2010 11:42 AM

All replies

  • The Expression Blend CodePlex samples have a rounded rectangle clipping behavior, if that will suit your purpose.

    ClippingBehavior- Provides a rounded rectangular clipping that scales with the element. Useful since Silverlight and WPF clipping geometries don't scale with objects

    http://expressionblend.codeplex.com/

    Thanks,
    Unni


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, May 17, 2010 6:23 PM
  • Hello,

    I have the same problem but I didn't reach the solution till now.

    Thank you

    Tuesday, May 18, 2010 8:08 AM
  • In generell resizing a clipping path does work like this:

    1) Create your clipping path in the xaml using Geometries. (I personally recommend to not use the path mini language). If you have a complex path geometry with many points I recommend to build it using the pen tool in Blend. As a result you get a geometry defined with the path mini language. Any geometry defined in path mini language can be translated to real xaml geometry shapes. So if you have a complex path translate the complex path to real geometry shapes in xaml. This makes it potentially easyier to modify the geometry parts which define your entire clipping path.

    2) x:Name any Geometry that defines your path.

    3) In code behind get access to the named geometries and change the attribute values as needed to change the size of the geometries. Use the SizeChanged event for example. To change the positions and size of the geometries which define your clipping path in fact is the most hardest part. Not, if you have a simple geometry like a RectangleGeometry or an EllipseGeometry, but if you have a complex geometry this can be head banging hard.

    Monday, January 24, 2011 7:32 AM