Custom labels on markers

7 posts, 1 answers
  1. Chintana
    Chintana avatar
    13 posts
    Member since:
    Jul 2010

    Posted 25 Jan 2011 Link to this post

    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
  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 28 Jan 2011 Link to this post

    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>>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Chintana
    Chintana avatar
    13 posts
    Member since:
    Jul 2010

    Posted 30 Jan 2011 Link to this post

    Thank you for your reply Andrey.
  5. Rob
    Rob avatar
    1 posts
    Member since:
    Feb 2011

    Posted 07 Feb 2011 Link to this post

    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>
  6. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 09 Feb 2011 Link to this post

    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>>
  7. Daniel
    Daniel avatar
    34 posts
    Member since:
    Oct 2011

    Posted 14 Feb 2012 Link to this post

    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.
  8. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 17 Feb 2012 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready