I have this rectangle in XAML :
<Rectangle x:Name="MyRectangle" Height="300" Width="300"></Rectangle>
I want to check if it intersects with another rectangle. In this question on SO, they say that one have to use the IntersectsWith method. But I'm unable to use it in code-behind. When I write in C# :
MyRectangle.IntersectsWith(
I get the standard error:
"System.Windows.Shapes.Rectangle does not contain a definition for 'IntersectsWith' and no extension method [...]"
I think that's because the rectangle in XAML is a System.Windows.Shapes.Rectangle
, and the method is for System.Windows.Rect
? If so, is there a way to "transform" my Rectangle
into a Rect
?