How to use MapPushpin in RadMap

2 posts, 0 answers
  1. Sunil Kumar
    Sunil Kumar avatar
    4 posts
    Member since:
    Oct 2016

    Posted 19 Oct Link to this post

    Hi,

     

    I'm trying to display multiple pushpin using RadMap. Below is my code and attached my requirement screenshot. Please advise.

     

    <telerik:RadMap Grid.Row="0" x:Name="radMap" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                                        ZoomLevel="{Binding ZoomLevel, Mode=TwoWay}" Center="{Binding MapCenter, Mode=TwoWay}">
                            <telerik:InformationLayer x:Name="radLocationPins" ItemsSource="{Binding Locations}">
                                <telerik:InformationLayer.ItemTemplate>
                                    <DataTemplate>
                                        <telerik:MapPinPoint telerik:MapLayer.Location="{Binding MapLocation}" Text="{Binding RowNumber}" Tag="{Binding UnitEvent_ParentEventID}" ImageSource="{Binding ImageSource}">
                                            <telerik:MapPinPoint.Template>
                                                <ControlTemplate>
                                                    <StackPanel x:Name="tmpPushPin" Tag="{Binding UnitEvent_ParentEventID}">
                                                        <i:Interaction.Triggers>
                                                            <i:EventTrigger EventName="MouseLeftButtonUp">
                                                                <ei:ChangePropertyAction TargetObject="{Binding Path=DataContext,ElementName=ReeferMapCW}" PropertyName="SelectedPushPin" Value="{Binding Tag, ElementName=tmpPushPin}" />
                                                                <ei:CallMethodAction TargetObject="{Binding Path=DataContext,ElementName=ReeferMapCW}" MethodName="ChangeSelectedItem"/>
                                                            </i:EventTrigger>
                                                        </i:Interaction.Triggers>
                                                        <!--StackPanel Height="34" Width="20">
                                                            <StackPanel.Background>
                                                                <ImageBrush ImageSource="{Binding ImageSource}"></ImageBrush>
                                                            </StackPanel.Background>
                                                            <TextBlock Height="4"></TextBlock>
                                                            <TextBlock Height="24"  Text="{Binding RowNumber}" Foreground="Black" FontWeight="Bold" FontSize="10" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
                                                        </StackPanel-->
                                                    </StackPanel>
                                                </ControlTemplate>
                                                </telerik:MapPinPoint.Template>
                                        </telerik:MapPinPoint>
                                    </DataTemplate>
                                </telerik:InformationLayer.ItemTemplate>
                            </telerik:InformationLayer>
                        </telerik:RadMap>

  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 21 Oct Link to this post

    Hi Sunhil,

    There are couple reasons why the provided code snippet won't work as expected.
    • The Provider property of the map control is not set. In order to make the map layers to be rendered properly and allow interactions as zooming and panning you will need to define a provider. In case you want to display only the information in the layers you can use EmptyProvider.
      <telerik:RadMap.Provider>
          <telerik:EmptyProvider />
      </telerik:RadMap.Provider>
    • There is nothing in the custom ControlTemplate of the MapPinPoint element. Make sure that the template defines the element you want to display.
    You can take a look at the attached project.

    Regards,
    Martin
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft banner
Back to Top