Location question

4 posts, 0 answers
  1. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 25 Feb 2010 Link to this post

    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
  2. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 25 Feb 2010 Link to this post

    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; 

  3. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 25 Feb 2010 Link to this post

    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
  4. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 01 Mar 2010 Link to this post

    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.
Back to Top