Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Map > Map not centering

Not answered Map not centering

Feed from this thread
  • Posted on Feb 27, 2012 (permalink)

    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


    Reply

  • Andrey Andrey admin's avatar

    Posted on Mar 1, 2012 (permalink)

    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 >>

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Posted on Mar 1, 2012 (permalink)

    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

    Reply

  • Andrey Andrey admin's avatar

    Posted on Mar 6, 2012 (permalink)

    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 >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Map > Map not centering