Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i check if 2 controls overlap eachother on a canvas in WPF?

I am writing a designer that enables the user to drag controls around the screen. What would be the best way of detecting if a control is overlapping another control while i am dragging the one control around?

Should i just get the dimensions of the FrameworkElement and keep on checking the dimensions of the other elements?

Thanks. Eli

like image 201
Eli Perpinyal Avatar asked Oct 12 '09 11:10

Eli Perpinyal


1 Answers

You can use the Rect.IntersectsWith method

like image 132
Thomas Levesque Avatar answered Oct 22 '22 00:10

Thomas Levesque