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

How to control MapPinPoint's text display or not

1 Answer 87 Views
Map
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jimmy
Top achievements
Rank 1
Jimmy asked on 03 May 2012, 08:44 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?

1 Answer, 1 is accepted

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

Greetings,
Andrey Murzov
the Telerik team

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

Tags
Map
Asked by
Jimmy
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or