Nested InformationLayer

2 posts, 0 answers
  1. John
    John avatar
    11 posts
    Member since:
    Sep 2011

    Posted 26 Jun 2012 Link to this post

    I have a collection of ScanSessions, each of which contains a collection of Waypoints. I have a RadGridView for displaying a list of the ScanSessions and I have another RadGridView for displaying the list of Waypoints in the selected ScanSession. I am also trying to write the XAML to create a RadMap InformationLayer that displays all the Waypoints for all the ScanSessions on a map. The reason for this is to make it easy to indicate on the map which Waypoint is selected in the grid view and vice versa.

    I tried to do this by nesting one InformationLayer inside another as seen in the following XAML:

        <local:LocationToTelerikConverter x:Key="LocationToTelerikConverter"/>
        <local:LocationCollectionToTelerikLocationCollectionConverter x:Key="LocationCollectionToTelerikLocationCollectionConverter"/>
          <SolidColorBrush x:Key="ControlSubtleForegroundBrush" Color="#004100"/>
        <DataTemplate x:Key="MapWaypointsTemplate">
            <Grid Tag="{Binding}" telerik:MapLayer.Location="{Binding Path=Location, Converter={StaticResource LocationToTelerikConverter}}">
                    <telerik:HotSpot ElementName="WaypointEllipse" X="0.5" Y="0.5" XUnits="Fraction" YUnits="Fraction"/>
                <Ellipse x:Name="WaypointEllipse" Width="20" Height="20" Fill="Blue"/>
    <Grid Background="Black">
        <telerik:RadMap x:Name="map" Background="Transparent" UseSpringAnimations="False" DistanceUnit="Kilometer" MouseClickMode="None"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                    UseDefaultLayout="False" MaxZoomLevel="24" MinZoomLevel="1" ZoomLevel="1"
                    MapMouseClick="OnMapMouseClick" CenterChanged="OnMapCenterChanged" ZoomChanged="OnMapZoomChanged" InitializeCompleted="OnMapInitializeCompleted" PreviewMouseMove="OnMapPreviewMouseMove"
                <!-- Provider set programmatically. -->
            <telerik:InformationLayer x:Name="scanSessionSnailTrailLayer" ItemsSource="{Binding ElementName=_this, Path=ScanSessions}">
                        <telerik:MapPolyline Stroke="Blue" StrokeThickness="2" Points="{Binding Path=WaypointLocations, Converter={StaticResource LocationCollectionToTelerikLocationCollectionConverter}}"/>
            <telerik:InformationLayer x:Name="scanSessionWaypointsOuter" ItemsSource="{Binding ElementName=_this, Path=ScanSessions}">
                        <telerik:InformationLayer x:Name="scanSessionWayPointsInner" ItemsSource="{Binding Path=Waypoints}" ItemTemplate="{StaticResource MapWaypointsTemplate}"/>

    The problem is that none of the Waypoint ellipses are displayed. I have also tried replacing both the outer and inner InformationLayer elements with simple ItemsControl elements, with no success.

    Note that the InformationLayer named scanSessionSnailTrailLayer works just fine.

    Does anybody have an idea how to get my nested InformationLayers to work?


    -- john
  2. Andrey
    Andrey avatar
    1681 posts

    Posted 29 Jun 2012 Link to this post

    Hi John,

    You can't use information layer inside another information layer. The information layer can be child of the RadMap control only. At the first glance there are 2 possible ways to solve the problem:

    1. You can fill in second information layer with waypoints from the code when ScanSessions property is changed.
    2. You can create additional property which will have collection type (ObservableCollection<Waypoint>, for example) and bind ItemsSource property of the second information layer to it. You will fill in this collection with waypoints from the code when ScanSessions property is changed.

    All the best,
    Andrey Murzov
    the Telerik team

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

Back to Top