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

How to use MapPushpin in RadMap

1 Answer 65 Views
Map
This is a migrated thread and some comments may be shown as answers.
Sunil Kumar
Top achievements
Rank 1
Sunil Kumar asked on 19 Oct 2016, 01:15 PM

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>

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 21 Oct 2016, 11:04 AM
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.
Tags
Map
Asked by
Sunil Kumar
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or