locked
How to check what UIElement is behind RRS feed

  • Question

  • Hi,

    In my application I have a StackPanel A, that can dragged and dropped. There is also another StackPanel B (static one) placed.

    Now I would like to achieve an effect so that every time I drag the StackPanel A above the StackPanel B there is an action taken.

    Basically what i need is a simple detextion mechanism.

    thanks!

    cheers

    pete

     

     

     

    Thursday, January 27, 2011 10:29 AM

Answers

  • Other way would be to see if there is any overlap between the two controls.

    You can either use VisualTreeHelper.FindElementsInHostCoordinates function to do this detection.

    Or since you know the Location (http://forums.silverlight.net/forums/p/16787/55877.aspx) and Size of both controls, so you should be able to tell if they have any overlap.




    Thursday, January 27, 2011 12:15 PM

All replies

  • You can hookup DragEnter/DragLeave events on the StackPanelB.


    Thursday, January 27, 2011 11:40 AM
  • THanks sladapter! I have tried and it didn't work.

    For dragging I'm using (for few reasons) TranslateTransform so it's not 'dragging' really. The events mentioned will not work.

    Is there any other way I could achive this?

    cheers

    pete

     

     

    Thursday, January 27, 2011 11:57 AM
  • Other way would be to see if there is any overlap between the two controls.

    You can either use VisualTreeHelper.FindElementsInHostCoordinates function to do this detection.

    Or since you know the Location (http://forums.silverlight.net/forums/p/16787/55877.aspx) and Size of both controls, so you should be able to tell if they have any overlap.




    Thursday, January 27, 2011 12:15 PM