This project is read-only.

Binding Of Map Control to a ViewModel

Mar 4, 2009 at 1:52 PM

Has anyone been working with MVVM and are interested in being able bind up more of the properties of the Map control to a ViewModel Class?  I noticed that many of the properties are not backed by dependency properties, and I was wondering if people were interested in this / if it might be in the roadmap at some point.  Any input would be greatly appreciated.

I really like the control, and I would like to use it as a library rather than locally branch the code off and make my changes as I move through it.  It's so much easier to drop the next version of the dll in, rather than trying to figure out the mess you made by merging the next version's code base into yours :).

Mar 5, 2009 at 6:21 PM
We too are using MVVM and feel your pain.

Mar 5, 2009 at 6:25 PM

I'm kind of curious.  What route did you decide to go down?  Did you take the properties of the Map control and make them simple backed dep. props. and have an update to each based on a change to (i think) LogicalOrigin, or did you think of a slicker way to set that up.  The issue I see, is that they are all dependent on one property and all update based on a change to one.  I'd love to get someone else's take on this.

Jul 21, 2009 at 1:35 PM

While this might be an older thread, I would like to add my agreement to it.

This blog has done some interesting work:

There needs to be a consistant, supported, way of databinding, not only the properties on the map, but the data on the map too.

I would love to be able to bind a collection of View Model objects to the map as a new layer.   And then have the collection's "visuals" and its location, determined through templates.  I really dont understand why the VE Map Control didnt have this from the get go.  There should be a Layer template and a "Point of Interest" template.

Then when I want to add a layer that represents earthquakes, I hit the USGS rss feed, get my view model of earthquakes, have a control template that represents an earthquake, create a layer, add the collection to the layer, add the layer to the map, and its done.  The control template would use the GeoRSS point lat and long from the rss feed to communicate the position of each quake to the map.  The magnitude would be something that was shown by the control template converting between a magnitude and a width.  I could let a designer have all kinds of fun with how they show the quake. 

I can do this in code, but it would be real nice to be able to use MVVM with an established, supported pattern. 

Thanks again for all of the great work that you guys have done on this site.