Matt
Matt

Reputation: 4603

Silverlight Bing Map with bindable amount of MapItemsControl

Is it possible to add something like ItemsSource to the Bing Map control to bind the MapItemsControls to a ObservableCollection? Actually I want to put different pushpin-styles on a map easily.

Upvotes: 0

Views: 528

Answers (2)

hoonzis
hoonzis

Reputation: 1737

If I understand your question, you would like to have a collection of MapItemControls added to a map - and this collection has to be bind-able - created dynamically?

I had a similar issue before. The solution for me was to create a new MapLayer and expose two-dimensional collection of items as DependencyProperty.

Here is a suggested approach:

public class SpecialLayer : MapLayer
{
    public static readonly DependencyProperty ItemsSource ... 
    OnPropertyChanged(...) 
    {
        var layer = sender as SpecialLayer;
        foreach(Object in Routes){
            layer.Add(new Pushpin(...));
        }
    }
}

I wrote a short post about it. You can check it to get some details.

Honza

Upvotes: 1

katit
katit

Reputation: 17895

Yes, you can do that and pretty much anything you want with layers.

There is all kind of examples available on official site: http://www.microsoft.com/maps/isdk/silverlight/

Upvotes: 0

Related Questions