Drawing directly on the canvas?

May 9, 2013 at 10:55 AM
I like to draw directly on the (map)canvas. In the MapControl is a property called RenderCanvas. So I do have the base canvas object.
But when I add a Child to this canvas, it is not shown. Maybe because the canvas's Children are cleared?
So, how can I draw to the canvas?
May 9, 2013 at 2:29 PM
Edited May 9, 2013 at 2:31 PM
I have to think about that one. I am not happy with RenderCanvas as a public property so I don't think this should be the way to enable this. Options:
  • Allow a specific platform dependent feature as point symbol
  • Add you own layer and transform it using the Map's Viewport
  • Add a special DrawingLayer for this purpose that is transformed by the renderer.
I can imagine in some cases you would like to place any UIElement on the map. It will remain a question if you want to scale that or not. You don't want to scale a button but you do want to scale a polygon. For what purpose do you want to use it?
May 10, 2013 at 12:50 PM
Two reasons:
  • as workaround for the previous issue (failing transparency for WP);
  • currently I add some UIElements to the canvas, like a textblock, border etc. This is meant for displaying things like speed, distance etc.
The better solution would be to place the UIElements on top of the canvas, but not as Child. I am not a really good xaml expert, so I do not know if that is possible.
May 24, 2013 at 6:41 PM
I too have a question on similar lines.

I would like to place any UIElement on the canvas from a class derived from MapControl.
Basically from a wrapper dll having Mapsui assemblies added as reference.

I would like to have a TextBox, a ContextMenu on the map but without changing any existing code of Mapsui.
May 31, 2013 at 10:20 AM
You can use XAML to display any UIElement on top of the canvas (but not as part of the canvas). That is exactly what I need to do.