This is a migrated thread and some comments may be shown as answers.

Hide Map ShapeLayer?

3 Answers 30 Views
Map
This is a migrated thread and some comments may be shown as answers.
mc
Top achievements
Rank 1
mc asked on 29 Jul 2019, 04:43 AM

Hi, I have a RadMap with separate ShapeLayers for boundaries and roads.  I would like to toggle the display of the roads. How do I do this with UI for UWP?

I tried binding the Visibility of the MapShapeLayer to a VM property.  This seems to allow me to turn visibility 'on' (show the ShapeLayer), but not off again.  

I have found I **can** toggle the Visibility of the entire RadMap using binding.  Is the only way to have two maps (one with the boundaries ShapeLayer and one with both boundaries and roads) in order to toggle the display of a ShapeLayer?

Many thanks

 

mcalex

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 30 Jul 2019, 02:22 PM
Hello mcalex,

Indeed, switching the Visibility of the ShapeLayer wouldn't be possible in this case. The other option you could try is to remove the respective shapelayer with the roads from the Layers collection of the Map and add it again when needed.

Let me know whether such an approach would be suitable for you.

Regards,
Yana
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
mc
Top achievements
Rank 1
answered on 02 Aug 2019, 07:36 AM

Hi Yana

Do you mean to add and remove the ShapeLayer programmatically?  If so, this won't be suitable as I'm attempting to utilise mvvm (as much as possible).

Now that I've worked out how to maintain a common Center and ZoomLevel between the two maps, apart from a slightly longer start-up, the hidden RadMap approach seems to work OK.

Many thanks

0
Yana
Telerik team
answered on 05 Aug 2019, 01:28 PM
Hello,

Yes, I meant removing and adding the ShapeLayer with code, but indeed, this requires a reference to the Map instance and will break the mvvm pattern.

I am glad to hear you've found a suitable solution with switching two maps.

Regards,
Yana
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Map
Asked by
mc
Top achievements
Rank 1
Answers by
Yana
Telerik team
mc
Top achievements
Rank 1
Share this question
or