Search code examples
c#uwpuwp-maps

Line over MapControl dissappears when out of right side or lower side of the control


I have different XAML Line Controls defined inside a MapControl. They change the rotation, color, ... so I thought it was better to do with lines that with MapPolyline which are supposed to stay static.

When panning around the map I found that when the origin of the lines are out of the MapControl, sometimes the lines dissappear, sometimes not. They dissappear only when outside the MapControl BUT on the right side or the lower side. THat doesn't happen when they pan out left side or upper side.

Obviously, I want them in the screen everytime, I don't want to dissappear them.

Any idea why it happens? And how can I get them visible all the time?

Lines visible when origin (orange point) inside the MapControl

Lines visible when origin (orange point) inside the MapControl Lines hidden when Lines origin outside right side Lines hidden when Lines origin outside right side. Orange point is partially visible.

Lines visible when origin outside left side Lines visible when origin outside left side. Even the orange point is outside the control, but lines are still visible.


Solution

  • I have found a solution for the dissapearing lines problem.

    All the lines and XAML shapes that were just on the MapControl should be grouped inside a canvas, width the correct width and height (in my case the max length of the lines in both dimensions and also negative and positive directions, center/anchor the canvas in the MapControl.Center and play with margins tofit all the controls correctly).

    For all the tests I have done, lines stays in th screen even both starting point and the ending point are not in the screen.