Changing the color of MapPolygon borders

2 posts, 1 answers
  1. Sam
    Sam avatar
    23 posts
    Member since:
    Oct 2011

    Posted 11 Jul 2012 Link to this post

    Hi everyone,

    I have loaded in a KML file containing U.S. zipcode areas which are then filled in via Information.Colorizer. If you look at the attached image, you can see that currently the zipcodes all have a white boarder around them. I'd really like to have a black border. I am trying to set the MapPolyon (and MapPath) Stroke, but that doesn't seem to have an effect. Instead they're coming out white.

    foreach (var mapgon in list)
    {
        ToolTip tooltip = new ToolTip();
        tooltip.Content = (mapgon.GetType() == typeof(MapPath)) ?
                                        ((MapPath)mapgon).ExtendedData : 
                                        ((MapPolygon)mapgon).ExtendedData;
                         
        tooltip.ContentTemplate = this.Resources["TooltipTemplate"] as DataTemplate;
        ToolTipService.SetToolTip(mapgon, tooltip);
     
        if (mapgon.GetType() == typeof(MapPath))
        {
            MapPath temp = (MapPath)mapgon;
            temp.Stroke = new System.Windows.Media.SolidColorBrush()
            { Color = System.Windows.Media.Color.FromArgb(255, 0, 0, 0) };
            temp.StrokeThickness = 4;
        }
        else
        {
            MapPolygon temp = (MapPolygon)mapgon;
            temp.Stroke = new System.Windows.Media.SolidColorBrush()
            { Color = System.Windows.Media.Color.FromArgb(255, 0, 0, 0) };
            temp.StrokeThickness = 4;
        }
        xInfoLayer.Items.Add(mapgon);
    }


    Can anyone see what I am doing wrong? Thanks!
  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 16 Jul 2012 Link to this post

    Hello Sam,

    The Colorizer has a priority. If it is specified for the information layer then filling settings made for the shape object will not be used. So you should change the correspondent value in the colorizer settings. For example:

    <telerik:ColorMeasureScale.ShapeFillCollection>
        <telerik:MapShapeFill Fill="White" Stroke="Black" StrokeThickness="2" />
        <telerik:MapShapeFill Fill="Red" Stroke="Black" StrokeThickness="2" />
    </telerik:ColorMeasureScale.ShapeFillCollection>


    Greetings,
    Andrey Murzov
    the Telerik team

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

  3. DevCraft banner
Back to Top