How to control MapPinPoint's text display or not

3 posts, 0 answers
  1. Jimmy
    Jimmy avatar
    24 posts
    Member since:
    Nov 2006

    Posted 03 May 2012 Link to this post

    I am going to add some MapPinPoint to the RadMap, these MapPinPoint contains image and text,I would like to display the MapPinPoint text in a specific zoom, other times only display the image.I tried to control this in ZoomChanged event, but no attribute can control the Text display or not, only can set the text assignment empty
    private void RadMapZoomChanged(object sender, EventArgs e)
            {
                if (radMap.ZoomLevel >= 13 && radMap.ZoomLevel < 22)
                {
                    SPBack.Visibility = Visibility.Visible;
    foreach (MapPinPoint point in Layer.Items)
                    {
                        point.Text = point.Tag;
                    } 

                }
                else
                {
                    SPBack.Visibility = Visibility.Collapsed;
                    foreach (MapPinPoint point in Layer.Items)
                    {
                        point.Text = "";
                    }
                }
            }
    How should I do if to achieve this function?  Is there has any better way?
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 08 May 2012 Link to this post

    Hi Jimmy,

    Unfortunately the MapPinPoint does not contain the functionality like you need. I would recommend to use a custom template for your data items. You can add necessary property in your data item class to allow changing a visibility of the text. For more information about Data Binding feature you can take a look at the following documentation topic and online example:
    http://www.telerik.com/help/silverlight/radmap-features-data-binding.html
    http://demos.telerik.com/silverlight/#Map/DataBinding

    Also the information layer supports using of the item template selector. It contains the AllowDataTemplateForZoomLevel property. When you set it to "true" then it allows using different templates for different zoom levels on the map.
    I have attached a sample solution which implements this approach.

    P.S. I highly reccomend that you avoid duplicate posts so that it is easier for both sides to follow the conversation. If any other questions on this arise I suggest that you choose between one of the forum posts and write there.

    Greetings,
    Andrey Murzov
    the Telerik team

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

  3. DevCraft banner
  4. Jimmy
    Jimmy avatar
    24 posts
    Member since:
    Nov 2006

    Posted 09 May 2012 Link to this post

    Thank you for you help!
Back to Top