Map not centering

4 posts, 0 answers
  1. krisdoff
    krisdoff avatar
    12 posts
    Member since:
    Nov 2006

    Posted 27 Feb 2012 Link to this post

    Hi there,
    Hopefully a simple question.

    I am getting the results of a geocode query back successfully, i.e. it appears to have a valid Long+Lat, but I cant seem to center the map on that location (and preferably zoom).  Do I need to do more than this?:

          private void geoProvider_GeocodeCompleted(object sender, GeocodeCompletedEventArgs e)
            {

                if (e.Response.Results != null && e.Response.Results.Count > 0)
                {

                     Telerik.Windows.Controls.Map.Location location = e.Response.Results[0].Locations[0];
                     radMap1.Center = location;

                }

            }


    Many Thanks


  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 01 Mar 2012 Link to this post

    Hi Chris,

    The code is OK.
    This behavior could occur when you restrict a panning region in RadMap specifying the GeoBounds property. And when a geocode result has the location which is out of this area.
    It is very complicated and it is hard to reproduce the problem without your solution, but using just a code snippet you sent. Could you, please, provide us with your solution or with a small sample solution which reproduces it?

    Greetings,
    Andrey Murzov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. krisdoff
    krisdoff avatar
    12 posts
    Member since:
    Nov 2006

    Posted 01 Mar 2012 Link to this post

    Hi there,

    Actually turned out to be the way I was declaring the control in XAML.  Not sure where I got the code from but it was this :

    <UserControl x:Class="Aurum.ShowAddress"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"
                  xmlns:aurum="clr-namespace:Aurum"

        mc:Ignorable="d"
        d:DesignHeight="500" d:DesignWidth="800" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
       
     
            <Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <aurum:AurumDialogue x:Name="frmPopup" PanelHeight="460" PanelWidth="620" TitleText="Choose order status" >
                    <aurum:AurumDialogue.Content>
                        <Grid Width="Auto" Height="Auto">
                        <telerik:RadMap Height="400" Width="600" HorizontalAlignment="Left"  Name="radMap1" VerticalAlignment="Top"  >
                <m:Map x:Name="myMap" CredentialsProvider="OURKEY" Mode="Road"/>
                                </telerik:RadMap>
                        </Grid>
                           
                    </aurum:AurumDialogue.Content>
                </aurum:AurumDialogue>
             
        </Grid>
    </UserControl>



    Thanks for your help though
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 06 Mar 2012 Link to this post

    Hello Chris,

    Your XAML definitely looks strange. The only child elements allowed for RadMap control are map layers (i.e. InformationLayer, DynamicLayer, VirtualizationLayer).

    Kind regards,
    Andrey Murzov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top