Manually Defined Legend

4 posts, 1 answers
  1. Bradley
    Bradley avatar
    4 posts
    Member since:
    Aug 2010

    Posted 27 Dec 2010 Link to this post

    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.
  2. Sia
    Admin
    Sia avatar
    667 posts

    Posted 30 Dec 2010 Link to this post

    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
  3. DevCraft banner
  4. Bradley
    Bradley avatar
    4 posts
    Member since:
    Aug 2010

    Posted 30 Dec 2010 Link to this post

    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.
  5. Answer
    Sia
    Admin
    Sia avatar
    667 posts

    Posted 31 Dec 2010 Link to this post

    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
Back to Top