locked
Blend TranslateZoomRotateBehavior ConstrainToParentBounds="True" is not working? RRS feed

  • Question

  •  <Canvas Background="White">
            <Ellipse Fill="Blue" Height="100" Width="100" Canvas.Left="141" Canvas.Top="115">
                <i:Interaction.Behaviors>
                    <ei:TranslateZoomRotateBehavior ConstrainToParentBounds="True"/>
                </i:Interaction.Behaviors>
            </Ellipse>
        </Canvas>

    This is my code. when i run the program application and try to move ellipse, the movement of ellipse crosses the parent element canvas. i set the ConstrainToParentBounds="True" property but its not working? Please suggest the answer

    • Moved by Lisa Zhu Thursday, May 9, 2013 9:06 AM blend related
    Monday, May 6, 2013 11:46 AM

All replies

  •  ConstrainToParentBounds="True" property is not working in TranslateZoomRotateBehavior. but this property is not working in MouseDragElementBehavior.When i use TranslateZoomRotateBehavior, element moves out of bounds of the parent element? How can i prevent it?

    please suggest the answer

    • Merged by Lisa Zhu Thursday, May 9, 2013 9:06 AM duplicate
    Monday, May 6, 2013 12:13 PM
  • Hi Vivek,

    I ‘d like to move this post to  Expression Blend + SketchFlow forum to get you better support.

    You may have more luck getting answers there.

    In addition, since you have posted the same question, I would merge them together to build a  good community environment.

    Thanks for your understanding.

    Regards,



    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Lisa Zhu Thursday, May 9, 2013 9:04 AM
    Wednesday, May 8, 2013 2:13 PM
  • Are you using a mouse to drag the element or touch? I took a look at the source using ilspy (steps shown below), and it looks like the constrain to parent property is only used for touch events, not for mouse drag events.

    1.  Open ilspy
    2.  Open Microsoft.Expression.Interactions.dll, usually in C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries
    3.  Find TranslateZoomRotateBehavior under Microsoft.Expression.Interactivity.Input
    4.  Right click ConstrainToParentBounds, analyze
    5.  See that it is used only by ManipulationDelta, which is registered to handle touch events.

    Thursday, May 9, 2013 1:22 PM
    Moderator
  • thanks for your answer.

    I used constrain to parent property to touch.but it is not working.I am using touch here.

    Wednesday, May 15, 2013 5:36 AM