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

Custom labels on markers

6 Answers 346 Views
Map
This is a migrated thread and some comments may be shown as answers.
Chintana
Top achievements
Rank 1
Chintana asked on 26 Jan 2011, 01:40 AM
Hello all,

Can someone point me out to the correct direction of putting a custom label on to a Marker ? For example, I have three locations on the map and I want to associate each of these locations (marker) with some custom information.

Thanks

6 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 28 Jan 2011, 10:18 AM
Hello Chintana,

I would recommend the you use the MapPinPoint instances in the information layer. It contains the Text property you can use to display your custom information.
The sample XAML code is below.
<Window x:Class="WpfApplication1.MainWindow"
        Title="MainWindow" Height="600" Width="800">
    <Grid>
        <telerik:RadMap
            Name="radMap"
            Center="40.946880350727568,-73.969381783963689"
            ZoomLevel="7">
            <telerik:RadMap.Provider>
                <telerik:OpenStreetMapProvider IsTileCachingEnabled="True" />
            </telerik:RadMap.Provider>
            <telerik:InformationLayer Name="informationLayer">
                <telerik:MapPinPoint telerik:MapLayer.Location="40.946880350727568,-73.969381783963689"
                                     BorderBrush="Black"
                                     BorderThickness="1"
                                     Background="Yellow"
                                     Text="Pin point #1"/>
                <telerik:MapPinPoint telerik:MapLayer.Location="40.46880350727568,-74.969381783963689"
                                     BorderBrush="Black"
                                     BorderThickness="1"
                                     Background="Yellow"
                                     Text="Pin point #2"/>
                <telerik:MapPinPoint telerik:MapLayer.Location="41.746880350727568,-72.669381783963689"
                                     BorderBrush="Black"
                                     BorderThickness="1"
                                     Background="Yellow"
                                     Text="Pin point #3"/>
            </telerik:InformationLayer>
        </telerik:RadMap>
    </Grid>
</Window>

Best wishes,
Andrey Murzov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Chintana
Top achievements
Rank 1
answered on 31 Jan 2011, 04:29 AM
Thank you for your reply Andrey.
0
Rob
Top achievements
Rank 1
answered on 07 Feb 2011, 06:36 AM
Can you please show me how to set the pin points in C#:
<telerik:RadMap
            Name="radMap"
            Center="40.946880350727568,-73.969381783963689"
            ZoomLevel="7">
            <telerik:RadMap.Provider>
                <telerik:OpenStreetMapProvider IsTileCachingEnabled="True" />
            </telerik:RadMap.Provider>
            <telerik:InformationLayer Name="informationLayer">
                <telerik:MapPinPoint telerik:MapLayer.Location="40.946880350727568,-73.969381783963689"
                                     BorderBrush="Black"
                                     BorderThickness="1"
                                     Background="Yellow"
                                     Text="Pin point #1"/>
                <telerik:MapPinPoint telerik:MapLayer.Location="40.46880350727568,-74.969381783963689"
                                     BorderBrush="Black"
                                     BorderThickness="1"
                                     Background="Yellow"
                                     Text="Pin point #2"/>
                <telerik:MapPinPoint telerik:MapLayer.Location="41.746880350727568,-72.669381783963689"
                                     BorderBrush="Black"
                                     BorderThickness="1"
                                     Background="Yellow"
                                     Text="Pin point #3"/>
            </telerik:InformationLayer>
        </telerik:RadMap>
0
Andrey
Telerik team
answered on 09 Feb 2011, 10:23 AM
Hi Rob,

Try the following approach:
MapPinPoint pin = new MapPinPoint()
{
    BorderBrush = new SolidColorBrush(Colors.Black),
    BorderThickness = new Thickness(1),
    Background = new SolidColorBrush(Colors.Yellow),
    Text = "Pin point #1"
};
MapLayer.SetLocation(pin, new Location(40.946880350727568, -73.969381783963689));
this.informationLayer.Items.Add(pin);

I hope this helps.

Greetings,
Andrey Murzov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Daniel
Top achievements
Rank 1
answered on 14 Feb 2012, 02:58 PM
I followed the above code, but cannot seem to find the informationLayer property on the RadMap class. The version is 2011 Q3, has there been an update somewhere along the to get rid of this? Thanks a lot.
0
Andrey
Telerik team
answered on 17 Feb 2012, 09:57 AM
Hello Daniel,

You can create the InformationLayer the following way:
<Window x:Class="WpfApplication1.MainWindow"
        Title="MainWindow" Height="600" Width="800">
    <Grid>
        <telerik:RadMap x:Name="radMap" Center="40.946880350727568,-73.969381783963689" ZoomLevel="7">
            <telerik:RadMap.Provider>
                <telerik:OpenStreetMapProvider />
            </telerik:RadMap.Provider>
            <telerik:InformationLayer x:Name="informationLayer" />
        </telerik:RadMap>
    </Grid>
</Window>

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 >>
Tags
Map
Asked by
Chintana
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Chintana
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Share this question
or