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

How to control MapPinPoint's text display or not

2 Answers 29 Views
Map
This is a migrated thread and some comments may be shown as answers.
Jimmy
Top achievements
Rank 1
Jimmy asked on 03 May 2012, 08:46 AM
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 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 08 May 2012, 08:34 AM
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 >>

0
Jimmy
Top achievements
Rank 1
answered on 09 May 2012, 04:18 PM
Thank you for you help!
Tags
Map
Asked by
Jimmy
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Jimmy
Top achievements
Rank 1
Share this question
or