Select to view content in your preferred language

Graphics Layer and Databinding?

842
2
04-29-2010 05:44 PM
JimJackson
New Contributor
I have a map with a graphics layer and a list of flight lines from GPS units. Within the extent of a given area I can have approximately 2k to 5k individual points and about 200 flight lines.

Right now, for each line I perform the following operations in a loop:

1. Create a Client.Geometry.PointCollection
2. Add my line points to the PointCollection
3. Create a Client.Geometry.Polyline
4. Add my PointCollection to the Polyline.Paths collection
5. Create a new Graphic and set it's symbol to the appropriate line symbol
6. Set the Graphic's symbol to my PolLine
7. Add the new Graphic to the Graphics Layer

This works pretty well but I'd prefer to databind it to values in my ViewModel. Does anyone know how to accomplish this with as little work as possible?

Many thanks,
Jim
0 Kudos
2 Replies
AnilDhiman
Deactivated User
I think a graphic layer is nothing but a kind of collection of objects. Here, I mean to say that create one observablecollection<GraphicLayer> kind of object in your viewmodel.
In view you should set some itemsource or Datacontext property to this collection.

I don't know the exact workaround for this, but this should work if you have properly architected MVVM pattern.
0 Kudos
JohanFerguson
New Contributor
What do you mean by databinding ? do you actually whant to retrieve the values from a database ?
0 Kudos