I dont think I can provide 100% of the answer... but here I go...
You can ask any visual for a GeneralTranform that tranforms coordinates
or bounds to another visual's coordinate system...
You could ask both your UIElements for a tranform to their common
ancestor and intersects the 2 rects...
This can be done using the methods:
Visual.TransformToAncestor()
Visual.TransformToDescendant()
Visual.TransformToVisual()
Unfortunatly... I'm not sure how this applies to UIElements with Layout
or Render Transforms... You would have to try by yourself.
You could always test for the 4 corners of your elements, to see if
they are inside the other element?!?
brian@sweetapp.com wrote:
> Hi,
>
> I've been looking for the answer to this question for a while.
>
> I would like to know if two UIElements intersect on the screen. These
> UIElements are in the same container but they have their margins
> specified in different ways (i.e. one is center aligned and one is left
> aligned) and have had various transformations applied to them. So
> calculating if they intersect is reasonably complex.
>
> Does anyone know of a way to accomplish this. Any help would be hugely
> appreciated.
>
> Cheers,
> Brian