How to Add zoomrange and style to Polylinedata dynamically

2 posts, 0 answers
  1. Sanjay
    Sanjay avatar
    21 posts
    Member since:
    Jun 2014

    Posted 20 Jan 2015 Link to this post

    Hi There

    1. With InformationLayer Map Shape, MapPolyLine i was able to set zoom range value and style dynamically, like code below, looking for equivalent code for PolyLineData.

    This works;
    MapPolyline polylinedata = new MapPolyline()            
                polylinedata.SetValue(MapLayer.ZoomRangeProperty, new ZoomRange(2, 9));
                polylinedata.SetValue(MapLayer.BaseZoomLevelProperty, 5);
                polylinedata.SetValue(MapLayer.MaxScaleProperty, 5);
                polyline.Style = this.Resources["selectedPolyLineStyle"] as Style;   

    Code below doesn't work;
    PolylineData polylinedata = new PolylineData();
               polylinedata.SetValue(MapLayer.ZoomRangeProperty, new ZoomRange(2, 9));
               polylinedata.SetValue(MapLayer.BaseZoomLevelProperty, 5);
               polylinedata.SetValue(MapLayer.MaxScaleProperty, 5);
               polyline.Style = this.Resources["selectedPolyLineStyle"] as Style;

    2. I have some 3K PolylineData framework elements which I'm creating dynamically live above , adding each of them to VirtualizationLayer in loop.This is quick but the because of 3K pPolylineData the Zoom and Panning performance is degraded.Kindly suggest the right approach.

    Thanks in Anticipation

    Thanks in Anticipation
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 23 Jan 2015 Link to this post

    Hello Sanjay,

    Let me go straight to your questions.

    1) In Visualization Layer, you can use these "MapLayer properties" on FrameworkElements - Ellipse, Rectangle Polyline, etc. Just like it is shown in the Visualization Layer Introduction help article. Also, you can set up these properties on elements in databinding scenarios - please have a look at this article.
    However, Map Shape data objects (LineData, PolylineData, RectangleData, etc) are not dependency objects and the MapLayer proeprties cannot apply on them. You will need to use code behind and events for such behaviors like zoomrange.

    2) As discussed in other ticket with you, you have to set up a VirtualizationSource for better performance.

    Regards,
    Petar Mladenov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top