I needed something similar. What I did was:
- Created a in xaml and linked its Points value to a PointCollection variable in my model and the Visibility with another one.
- Then at the
mouseclickevent, I get the
e.GetPosition which gives you screen coordinates of you mouse.
From here, you can calculate your coners in screen coordinates, but I needed them in my coordinate system. So I did:
mainpage.ScreenToMap(screenPoint) you can convert it to a MapPoint with a specific spatial reference system.
- From this point, you can calculate your corners (easier with projected reference system so you could use meters)
- Save you corners as screen points in the
System.Windows.Media.PointCollection variable and control the visibilty of your polygon with the visibility variable.