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

Location question

3 Answers 68 Views
Map
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 25 Feb 2010, 04:10 PM
I am binding my LocationBox to a List from a web service. I need to cast the value coming from the selecteditem to a Location object, how can I do this programatically? Right now I have a Name field and a Location field, the locationfield is long and lat.

Thanks!
Sam

3 Answers, 1 is accepted

Sort by
0
Sam
Top achievements
Rank 1
answered on 25 Feb 2010, 04:37 PM
I tried to set the RadMap location programatically like this, but it doesn't work the map doesn't even show up.
                Location loc = new Location(); 
                string strLongitude = "-96.193542"
                double longitude = double.Parse(strLongitude); 
                loc.Longitude = longitude; 
 
                string strLatitude = "41.287576"
                double latitude = double.Parse(strLatitude); 
                loc.Latitude = latitude; 
 
                loc.Description = "Elkhorn Ne"
 
 
                RadMap1.Center = loc; 

0
Sam
Top achievements
Rank 1
answered on 25 Feb 2010, 05:36 PM
I think it has to do with the mapNameSpace tags, I need to dynamically add mapNameSpace tags in a list box from a web service. I tried to add them in a datatemplate but I got a XAML error. My entire application depends on this functionality. I need to generate these tags:

 <ListBox x:Name="LocationBox" DisplayMemberPath="Description" SelectionChanged="LocationBox_SelectionChanged" ItemContainerStyle="{StaticResource lv-ListBoxItem}" Background="Transparent" BorderBrush="Transparent"
                <mapNamespace:Location Description="All" Latitude="42.358431" Longitude="-71.059773"/> 
                <mapNamespace:Location Description="Bob Miller" Latitude="29.763284" Longitude="-95.363272"/> 
                <mapNamespace:Location Description="Jim Simpson" Latitude="48.139126" Longitude="11.580186"/> 
                <mapNamespace:Location Description="Tom Larson" Latitude="29.763284" Longitude="-95.363272"/> 
                 
            </ListBox> 

Thanks!
Sam
0
Giuseppe
Telerik team
answered on 01 Mar 2010, 01:07 PM
Hello Sam,

Check the attached sample application here.


Regards,
Manuel
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
Sam
Top achievements
Rank 1
Answers by
Sam
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or