hardgraf7

Binding the map control in MVVM?

Discussion created by hardgraf7 on Sep 30, 2013
Latest reply on Sep 30, 2013 by akajanus-esristaff
Hi all.

I have written a simple app with code behind which I now want to convert to MVVM. I had a double mouseclick event on my map which got the position and returned the mapPoint to a text box which worked fine:

I then created a View Model class and wrote my own DoubleClick method. Any ideas on how to bind the map to this method in the XAML?

public void DoubleClick(object sender, GraphicMouseEventArgs e)
        {

            MainWindow main = new MainWindow();

            Point screenPoint = e.GetPosition (main.MapWindow);
            MapPoint mapPoint = main.MapWindow.ScreenToMap(screenPoint);

            GEOMText = mapPoint.ToString();
        }

Outcomes