MVVM Windows Phone 8 - adding a collection of pushpins to a map

前端 未结 2 1228
我在风中等你
我在风中等你 2020-12-15 13:07

Here is the XAML code:



        
2条回答
  •  感情败类
    2020-12-15 13:32

    The MapItemsControl is currently not yet MVVM bindable ( what I am aware off ). So best way is to set it's ItemsSource in the code behind of your view.

    You can still use the collection defined in your ViewModel though! Options are:

    • through mvvm messaging pass along the collection from the viewmodel to the code behind of the view
    • use the datacontext of the view to access the collection, something like this: this.StoresMapItemsControl.ItemsSource = ServiceLocator.Current.GetInstance().Locations;

提交回复
热议问题