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

initial location position error

2 Answers 28 Views
Map
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 15 Nov 2011, 05:27 PM
Hello,

Again, not sure if I'm doing something wrong here or not.  I am using OpenStreetMapProvider and binding an information layer to two Location points with a custom display template. 

The DataTemplate is;
<Grid telerik:MapLayer.Location="{Binding Path=Location}" 
telerik:MapLayer.BaseZoomLevel="1"
telerik:MapLayer.ZoomRange="1,10">
  <telerik:MapLayer.HotSpot>
    <telerik:HotSpot Y="1.0" X="0.0"
        XUnits="Fraction" 
        YUnits="Fraction" 
        ElementName="PART_HotSpot" />
  </telerik:MapLayer.HotSpot>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="12" />
    <ColumnDefinition Width="48" />
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
    <RowDefinition Height="10" />
    <RowDefinition Height="12" />
    <RowDefinition Height="Auto" />
  </Grid.RowDefinitions>
  <Image x:Name="PART_HotSpot" 
     Grid.Row="1"  Grid.Column="0"  
     VerticalAlignment="Top" HorizontalAlignment="Left" 
     Source="{Binding Path=PinImageSource}" />
  <Border Grid.Row="0"  Grid.Column="1" 
     Background="#80000000" BorderBrush="Black" BorderThickness="1">
     <TextBlock VerticalAlignment="Center" 
          Text="{Binding Path=PortName}" 
          FontSize="7" FontFamily="Arial"
          Foreground="White"/>
   </Border>
</Grid>

The information layer is bound to an ObservableCollection<MyObject> where MyObject has a Location property exposed.

When I initially load the UserControl (mapView_Loaded event handler), I "retrieve" the data.  This populates the ObservableCollection in the view model and fires the notifypropertychanged event which I have attached a handler in the UserControl in order to execute the GetBestView of the information layer.  My locations can be very close or opposite sides of the world, so want the map to auto-zoom.  When the points are initially displayed, the positions/location of the elements is wrong.  (see attached image startup_position.png).  If I pan, the locations remain incorrect, however, if I zoom in one level and back, the positions adjust and are placed correctly (see attached image zoomin_out_position.png) and are then fine afterwards when panning and zooming.  I tried different geo locations and zoom levels but it was the same.  The very first view is incorrectly positioned. Obviously I can't have the users needing to trigger a zoom to correctly position the elements. 

The version I am using is outdated (Q3 2010, 2010.3.1314.1040), and upgrading is a very hard sell at the moment, so I'm stuck with what I have.  I'm hoping this is not an issue with this version.  Is there something I'm doing wrong here, or is this a bug that has been resolved in a newer release?

Thanks.
Alex.

2 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 18 Nov 2011, 09:46 AM
Hi Alex,

Unfortunately the build you use contains a problem with using the MapLayer.BaseZoomLevel attachable property within the item template of information layer. So, I would recommend to use the latest version of the map control.

As an alternative way you can consider a scenario without using this property. For example you can use the item template selector and the InformationLayer.AllowDataTemplateForZoomLevel property for loading separate templates for each zoom level.

Kind regards,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Alex
Top achievements
Rank 1
answered on 22 Nov 2011, 08:01 PM
Hello Andrey,

I thought that might be the case.  I have passed this on to management and hopefully they will spring for an upgrade.

Thanks.
Tags
Map
Asked by
Alex
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Alex
Top achievements
Rank 1
Share this question
or