InformationLayer binding

2 posts, 0 answers
  1. Anton Z
    Anton Z avatar
    9 posts
    Member since:
    Oct 2008

    Posted 16 May 2010 Link to this post

    Hello,

    I have an MVVM application.
    In this application I use RadMap control with search engine via BingSearchProvider class.
    If I binding result of work BingSearchProvider as ObservableCollection<Location> all works perfectly,
    <telerik:InformationLayer x:Name="informationLayer"  
        ItemsSource="{Binding Path=LocationData.SearchResult}"
     <telerik:InformationLayer.ItemTemplate> 
    .... 
     
     
    public ObservableCollection<Location> SearchResult { getprivate set; } 
     
    private void geoHelper_SearchCompleted(object sender, LocSearchCompletedEventArgs e) 
        SearchResult.Clear(); 
     
        var searchResult = e.Locations as ObservableCollection<MyMapItem>; 
        foreach(MyMapItem loc in searchResult) 
            SearchResult.Add(loc.Location); 

    but if I try to wrap result in MyMapItem and try binding ObservableCollection <MyMapItem>
    the map refuses to display search result positions on InformationLayer.
    <telerik:InformationLayer x:Name="informationLayer"  
        ItemsSource="{Binding Path=LocationData.SearchResult.Location}"
     <telerik:InformationLayer.ItemTemplate> 
    .... 
     
    public class MyMapItem 
        public Location Location 
        { 
            get
            set
        } 
     
        public string Title 
        { 
            get
            set
        } 
     
        public string Description 
        { 
            get
            set
        } 
     
    public ObservableCollection<MyMapItem> SearchResult { getprivate set; } 
     
    private void geoHelper_SearchCompleted(object sender, LocSearchCompletedEventArgs e) 
        SearchResult.Clear(); 
     
        var searchResult = e.Locations as ObservableCollection<MyMapItem>; 
        foreach(MyMapItem loc in searchResult) 
           SearchResult.Add(loc); 

    How i can solve this problem? How i can use custom class for display position on Radmap control? I don't want use buffer object list =(

    Here is located the simple project which demonstrate a problem 

  2. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 20 May 2010 Link to this post

    Hi Anton Z,

    You should use the DataMappings on the InformationLayer class. With them you can indicate which property contains the Loction, Latitude or Longitude. Check this example for more info.

    Sincerely yours,
    Vladimir Milev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top