I have a problem i cannot solve.
In my view (that shows a map) i created a contextMenu. When context menu is invoked i need to get the position where the user has clicked on the map.
Here is my problem:
In the view i already have onMouseDown event that gets me the coordinates where the user clicked.
private void MapView_MouseDown(object sender, MouseEventArgs e)
{
this.lastMouseDownX = e.X;
this.lastMouseDownY = e.Y;
}
When the contextMenu is invoked i need the same data, but the problem is that contextMenu only has EventArgs that dont keep the data i need. Furthermore ... contextMenu is invoked when user presses and holds mouse for a second and when its invoked the code does not enter onMouseDown event ! It just goes into popup event on my context menu....
I tried putting this in my popup event, but the coordinates are not ok. Y coordinate is way off the chart.
private void servicesContextMenu_Popup(object sender, EventArgs e)
{
this.lastMouseDownX = Control.MousePosition.X;
this.lastMouseDownX = Control.MousePosition.Y;
}
I also tried this, but with no success ... the problem remains ... when contextMenu is invoked the code does not fire onMouseDown event.
http://www.mofeel.net/58-microsoft-public-dotnet-framework-compactframework/19285.aspx
Help?