This is a migrated thread and some comments may be shown as answers.

InformationLayer binding

1 Answer 180 Views
Map
This is a migrated thread and some comments may be shown as answers.
Anton Z
Top achievements
Rank 1
Anton Z asked on 16 May 2010, 06:03 PM
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 

1 Answer, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 20 May 2010, 10:34 AM
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.
Tags
Map
Asked by
Anton Z
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Share this question
or