1

Is it possible to add custom styling to polyline in Windows UWP maps control? For example can you make a gradient on the line so one side is bold and then fades to the other side, or maybe make the edges of the line blurred.

enter image description here

rbrundritt
  • 16,570
  • 2
  • 21
  • 46
erotavlas
  • 4,274
  • 4
  • 45
  • 104
  • Do you have to use [MapPolyLine](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.maps.mappolyline.aspx) class? Can we bind an image which already has these effects to the map? – Sunteen Wu May 30 '16 at 07:05
  • @Sunteen I suppose not, but whatever alternative there is, I must be able to set the position of the line dynamically at run time based on a series of geo points. Currently my polyline points are bound to an observable collection of BasicGeoPoint defined in my viewmodel. – erotavlas May 30 '16 at 14:11
  • Bind a image also can define its location. please see scenario3 of [MapControl official sample](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/MapControl/cs). – Sunteen Wu Jun 01 '16 at 06:30

1 Answers1

3

The UWP map control is a native C++ control and rendering of polylines, polygons, and MapIcons are done using native C++. As such most XAML styling functionalities are not an option. The MapPolyline class allows you to customize the stroke color, stroke thickness and the make the line a dashed line. Documentation is here: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.maps.mappolyline.aspx

The color must be a Color and not a brush.

rbrundritt
  • 16,570
  • 2
  • 21
  • 46