none
UWP MapPolygon stroke does not set correctly RRS feed

  • Question

  • I'm placing multiple MapPolygons on a MapControl. The stroke for the MapPolygons do not set correctly. The stroke color for all polygons regardless of what layer they reside in binds to the polygon with the highest Zindex. I created an example using the UWP MapControl example from Microsoft "Add a shape" section.

    I tried placing each polygon in a separate layer with the same effect. It is worth noting that the Polygon FillColor parameter is unaffected only the stroke color and thickness. My target build is 16299. If I draw a single polygon, the stroke shows correctly.

        public void test_polygons()
        {
            double centerLatitude = Emitter_Position.Position.Latitude;
            double centerLongitude = Emitter_Position.Position.Longitude;
            var MyHighlights = new List<MapElement>();
            var mapPolygon = new MapPolygon
            {
                Path = new Geopath(new List<BasicGeoposition> {
                    new BasicGeoposition() {Latitude=centerLatitude+0.1, Longitude=centerLongitude-0.1 },
                    new BasicGeoposition() {Latitude=centerLatitude-0.1, Longitude=centerLongitude-0.1 },
                    new BasicGeoposition() {Latitude=centerLatitude-0.1, Longitude=centerLongitude+0.1 },
                    new BasicGeoposition() {Latitude=centerLatitude+0.1, Longitude=centerLongitude+0.1 },
                }),
                ZIndex = 2,
                FillColor = Colors.Red,
                StrokeColor = Colors.Blue,
                StrokeThickness = 3,
                StrokeDashed = false,
            };

            var mapPolygon2 = new MapPolygon
            {
                Path = new Geopath(new List<BasicGeoposition> {
                    new BasicGeoposition() {Latitude=centerLatitude+0.2, Longitude=centerLongitude-0.2 },
                    new BasicGeoposition() {Latitude=centerLatitude-0.2, Longitude=centerLongitude-0.2 },
                    new BasicGeoposition() {Latitude=centerLatitude-0.2, Longitude=centerLongitude+0.2 },
                    new BasicGeoposition() {Latitude=centerLatitude+0.2, Longitude=centerLongitude+0.2 },
                }),
                ZIndex = 1,
                FillColor = Colors.Green,
                StrokeColor = Colors.Yellow,
                StrokeThickness = 3,
                StrokeDashed = false,
            };

            MyHighlights.Add(mapPolygon);
            MyHighlights.Add(mapPolygon2);
            var HighlightsLayer = new MapElementsLayer
            {
                ZIndex = 1,
                MapElements = MyHighlights
            };
            Result_Map.Layers.Add(HighlightsLayer);

        }
    The stroke color for mapPolygon2 shows as blue rather than yellow. If you flip the Zindex for the mapPolygons than the stroke for both polygons will be yellow. So what's the trick to get the stroke to set correctly when displaying multiple polygons?
    Wednesday, October 2, 2019 1:38 PM

All replies

  • This was a known issue with earlier versions of Windows, but the latest versions should behave as expected.
    Wednesday, October 2, 2019 7:54 PM
    Moderator
  • Hi Jason,

    Can you provide the version number of Windows you are using and also apply any pending updates to see if that clears this issue?

    Sincerely,

    IoTGirl

    Wednesday, October 2, 2019 9:42 PM
    Owner
  • Thx for your reply. I am currently on Window 10, Ver 1709. Unfortunately I am at the mercy of my IT department concerning Window's updates. Can you verify that this version has the issue and I will work around the issue until my company decides to update their software.
    Wednesday, October 2, 2019 11:23 PM
  • Hi Jason,

    I am on version 1903 so I assume Duncan is also on that version as well.  If you want deeper details of each Windows Build, I recommend joining Windows Insiders.

    Sincerely,

    IoTGirl

    Thursday, October 3, 2019 3:29 PM
    Owner