How to Bind Muiltiple latitude and longitude to single Radmap

4 posts, 1 answers
  1. 666
    666 avatar
    17 posts
    Member since:
    Sep 2010

    Posted 17 Dec 2010 Link to this post

    Hi
     I am using radmap in my silverlight 4.0 application, i want to Bind Muiltiple latitude and longitude to radmap, if there is two location is there i want to draw line in between to locations With some color line like Rad and green , how to do this?

    Thanks in Advance
  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 22 Dec 2010 Link to this post

    Hi srini,

    You can bind items source of the information layer to the collection of the locations. You can find an example here:

    http://demos.telerik.com/silverlight/#Map/DataBinding

    To show line between 2 locations on the map you can use MapLine object:

    Location loc1 = new Location(20, 20);
    Location loc2 = new Location(40, 40);
    MapLine line = new MapLine()
    {
        Point1 = loc1,
        Point2 = loc2,
        Stroke = new SolidColorBrush(Colors.Red),
        StrokeThickness = 2
    };
      
    this.informationLayer.Items.Add(line);


    Pay attention, if your information layer is bound to the collection of the locations then you should use second layer to show lines.

    Kind regards,
    Andrey Murzov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. 666
    666 avatar
    17 posts
    Member since:
    Sep 2010

    Posted 30 Dec 2010 Link to this post

    Hi

     I have binded the radmap with muiltiple lat & long value it is working fine,i am using  bellow code to draw line in between two location  on radmap  it is also working fine . i want to draw a dotted line between to locations, how to do this?

     

     

     

    private LinearGradientBrush CreateLinearGradientBrush(Location location1, Location location2)

     

    {

     

     

    Point point1 = location1.GetPoint(this.radMap);

     

     

     

    Point point2 = location2.GetPoint(this.radMap);

     

     

     

    var fill = new LinearGradientBrush();

     

    fill.StartPoint =

     

    new Point(0, 0);

     

    fill.EndPoint =

     

    new Point(point2.X - point1.X, point2.Y - point1.Y);

     

     

     

    double max = Math.Max(Math.Abs(fill.EndPoint.X), Math.Abs(fill.EndPoint.Y));

     

    fill.EndPoint =

     

    new Point(fill.EndPoint.X / max, fill.EndPoint.Y / max);

     

     

     

    if (fill.EndPoint.X < 0)

     

    {

    fill.StartPoint =

     

    new Point(-fill.EndPoint.X, fill.StartPoint.Y);

     

    fill.EndPoint =

     

    new Point(0, fill.EndPoint.Y);

     

    }

     

     

    if (fill.EndPoint.Y < 0)

     

    {

    fill.StartPoint =

     

    new Point(fill.StartPoint.X, -fill.EndPoint.Y);

     

    fill.EndPoint =

     

    new Point(fill.EndPoint.X, 0);

     

    }

     

     

    return fill;

     

    }

     

     

    private void SetLinearGradientBrushStops(LinearGradientBrush fill, Color startColor, Color stopColor)

     

    {

     

     

    var stop = new GradientStop();

     

    stop.Color = startColor;

    stop.Offset = 0;

    fill.GradientStops.Add(stop);

     

     

    var stop1 = new GradientStop();

     

    stop1.Color = stopColor;

    stop1.Offset = 1;

    fill.GradientStops.Add(stop1);

    }

    Thanks in Advance

  5. Sia
    Admin
    Sia avatar
    667 posts

    Posted 31 Dec 2010 Link to this post

    Hi,

    You need to set the StrokeDashArray as follows:
    StrokeDashArray = new DoubleCollection {2,2};

    Regards,
    Sia
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top