GMap for WPF using MVVM ?

Topics: WPF
Jun 4, 2010 at 9:25 AM


I'm starting to work with WPF, and one part is created a map. After a search I find that project and find it amazing.

But the problem, is that they want to based the project in the MVVm model,   and I'm having a lot of problems to integrate the existent GMap to it, because a lot of stuff works different

Have anyone try to make a mvvm project with Gmap? Any recomendation where i can find a guide to make the adaptationt?

Thanks in advance



Jun 4, 2010 at 10:55 AM

..can you explain more what you expect?

Jun 4, 2010 at 1:20 PM

let me explain.

I have download the examples, and in the wpf map example(demo.windowspresentation) you have a view called Mainwindow, with a part of xaml, and other part code, where is all the logic, connection and usage of the map

But if you use the MVVM pattern , the code of the view cant be used, because it belongs to the view and view is supossed to show the data. You have to crete/use a new class (usually called ____viewmodel) where is the new one where all the logic belongs

Usually in the MVVM pattern, you have simply indicate to the textbox of listbox, the origin of the datasource, and he make all the stuff that you need. But with the map is not so easy

I create the new class, and i have to find a way to comunicate both classes, since any change that the use propose (like zoom) have to go to the new viewmodel class, execute the need process, and then return to the view, to show the result.  

And thats the part I'm working now, create a map object in the viewmodel, and allow the view to send request and receive the new propietes, so it can be redraw . I hope that someone else have maybe try it before, 

I hope I have express myself Correctly

Jun 4, 2010 at 3:16 PM

..but why to make life difficult? ;}

Dec 23, 2010 at 7:26 PM

alexqs, did you ever get this working using MVVM?

Radioman, it does make life more difficult but seperates concerns, it can make it easier to change the UI without breaking it and gives the ability to unit test the View Models.

I'm fairly sure it's accepted as the best way to develop WCF and silverlight applications.

Jan 3, 2011 at 1:51 PM

sure, but someone need to implement it, maybe some day