Hide Map ShapeLayer?

4 posts, 0 answers
  1. mc
    mc avatar
    4 posts
    Member since:
    Jul 2019

    Posted 28 Jul 2019 Link to this post

    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

  2. Yana
    Admin
    Yana avatar
    4942 posts

    Posted 30 Jul 2019 Link to this post

    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
  3. mc
    mc avatar
    4 posts
    Member since:
    Jul 2019

    Posted 02 Aug 2019 in reply to Yana Link to this post

    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

  4. Yana
    Admin
    Yana avatar
    4942 posts

    Posted 05 Aug 2019 Link to this post

    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
Back to Top