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

Manually Defined Legend

3 Answers 65 Views
Map
This is a migrated thread and some comments may be shown as answers.
Bradley
Top achievements
Rank 1
Bradley asked on 28 Dec 2010, 01:03 AM
Is there a way to define the Map Legend in XAML or in code-behind directly?  I played around with it a little today and couldn't get it to even show up. I want it to show something really simple like 5 colored bricks and lables next to them, and a title label (which I could desich in XAML and overlay but if Telerik has made it easer...

I'm databinding the items for the map and using the default OpenStreetMap provider.

Anyone had any success with this, or have a similar predicament?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 30 Dec 2010, 04:19 PM
Hello Bradley,

Please check this example and look at this help topic where you can find more information about the Map Legend object.

Best wishes,
Sia
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Bradley
Top achievements
Rank 1
answered on 30 Dec 2010, 08:58 PM
I guess I was a bit unclear, so let me clarify:

The heat map basically automatically generates the map legend items based on the ColorMeasureScale and it's various properties. I, however, was/am looking for a way to manually, in XAML most likely, set the items in the legend.  You know so I don't have to create one myself...  Anyways, imagine I have a map with 10 hot spots on it and there are 6 hotspots in yellow, 3 in red, and one in blue.  I want to have the legend have 3 legend items, as it were, with a colored rectangle and a text block for a description, one for each item.

Does that make sense?

Anyone else using the map in this way?  I can't imagine I'm the only one using it that way, or wanting to, but I could be wrong...

Here is an excerpt of my RadMap (basically the hotspots are much more complex):
<my:RadMap x:Name="RadMap1" ZoomLevel="14" Center="{Binding Path=MapCenter}">
    <telerik:InformationLayer x:Name="InformationLayer" ItemsSource="{Binding Path=MapItems}">
        <telerik:InformationLayer.ItemTemplate>
            <DataTemplate>
                <Grid telerik:MapLayer.BaseZoomLevel="{Binding BaseZoomLevel}"
                                    telerik:MapLayer.Location="{Binding Location}"
                                    telerik:MapLayer.ZoomRange="{Binding ZoomRange}">
                    <telerik:MapLayer.HotSpot>
                        <telerik:HotSpot X="0.5" Y="0.5" 
                                    ElementName="OrbCanvas" />
                    </telerik:MapLayer.HotSpot>
                    <Grid x:Name="OrbCanvas" Width="23" Height="23">
                        <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16">
                            <Ellipse x:Name="Orb" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16">
                                <Ellipse.Fill>
                                    <SolidColorBrush Color="{Binding HotSpotBackgroundMain}" />
                                </Ellipse.Fill>
                            </Ellipse>
                            <ToolTipService.ToolTip Content="{Binding Caption}" />
                            <Grid.Effect>
                                <DropShadowEffect/>
                            </Grid.Effect>
                        </Grid>
                    </Grid>
            </DataTemplate>
        </telerik:InformationLayer.ItemTemplate>
    </telerik:InformationLayer>
</my:RadMap>


Thanks.
0
Accepted
Sia
Telerik team
answered on 31 Dec 2010, 02:51 PM
Hi Bradley,

Please excuse me for the misunderstanding. If you need to generate a map legend by yourself, please check this example. I think that this is what you need - a manually generated map legend overlaying the RadMap.

Please let me know if this works in your scenario.

Greetings,
Sia
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Map
Asked by
Bradley
Top achievements
Rank 1
Answers by
Sia
Telerik team
Bradley
Top achievements
Rank 1
Share this question
or