SurfaceVEMap Binding to SurfaceVEPushPin BindingList with ItemTemplate

Jan 25, 2010 at 11:37 AM
Edited Jan 25, 2010 at 1:08 PM


Have been using the VE Map for surface for a little while now. Lot's of fun!

But there is a problem which i have been encountering as well.

When i create a BindingList of SurfaceVEPushPin and bind the using the ItemsSource on the SurfaceeVEMap, the pushpin´s are show nice on the globe at the exact Latitude and Longitude.
Now i want to customize the items with a custom object and using the SurfaceVEMap.ItemTemplate and DataTemplate. The pins are shown, but on the left of the screen and not on the latitude-longitude.

I used the Mole Visualizer to drill into the actual generated Xaml and found out that when i use a ItemTemplate, a ContentPresenter is placed around every SurfaceVEPushpin wich could lead to the misbehaviour of pins on the map.

Anybody familiar with te same problem? And has another solution for this binding issue?





Jan 25, 2010 at 6:03 PM

SurfaceVEMap.ItemTemplate dosn't appear to work; it look like SurfaceVEPushPin, which your controls will need to be
wrapped in arn't registering them with the parent map. If you loop a the SurfaceVEPushPin.Map property you'll see it;s
null. The work aroung that found is to place the controls directly into the ItemsSource.

Not nice but it work

Jan 27, 2010 at 4:10 PM

Oke, i fixed the problem.

No more use of the ItemTemplate.

I created a Custom control which i instatiate for each pushpin with the data to display in te constructor.
Then, when creating a SurfaceVEPushpin object to add to the Bindinglist (which i use as Itemssource), i use this instance of the custom Control as the Content fo the Pushpin. Et voila!




Jan 28, 2010 at 10:47 PM

Hi guys,

Sorry about the issues with ItemsSource and DataTemplate. I'll be taking a look at that soon for a quick refresh.


Jan 30, 2010 at 10:39 PM
Edited Jan 30, 2010 at 10:40 PM

Check out the latest source upload, changeset 39350. Data binding is fixed and I also have a sample of how to use it, among other things.