This project has moved. For the latest updates, please go here.

Adding a stroke/border to MapRectangle

Aug 23, 2014 at 11:28 PM
I want to add a border to the MapRectangles but I can't seem to figure out how. I've tried adding a stroke to an ItemContainerStyle and and ItemContainerTemplate. I also tried adding a Border to both of those.

Here's the style I'm currently trying out:

<Style x:Key="RectangleItemStyle" TargetType="map:MapItem">
            <Setter Property="BorderBrush" Value="Blue" />
            <Setter Property="BorderThickness" Value="10" />
            <Setter Property="Template">
                        <map:MapRectangle Fill="#CCC0C0C0" North="{Binding North}" East="{Binding East}" West="{Binding West}" South="{Binding South}" Tapped="MapRectangle_Tapped"/>
I haven't found an easy way to show a border around a MapRectangle. The only way I've found is to add a MapPolyline but I've got over 1500 shapes and the rectangles have better performance than that many polylines.

All I need to do is have Rectangles with outlines so they can be differentiated from neighboring rectangles.
Aug 24, 2014 at 11:10 AM
Edited Aug 24, 2014 at 11:10 AM
MapRectangle is meant to fill a rectangular area with a Brush, mainly when it serves as base class for MapImage, where the Brush is an ImageBrush. It uses RenderTransform to transform from world coordinates to viewport coordinates and would hence also visually scale any stroke. So if you want to avoid MapPolyline, you might perhaps use the base class MapPath instead and set its Data property to an appropriate RectangleGeometry.
Marked as answer by ebsanu on 8/25/2014 at 12:20 PM