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

How to attach a MapPolygon to an InformationLayer with C# -- not XAML?

1 Answer 37 Views
Map
This is a migrated thread and some comments may be shown as answers.
Yan Moura
Top achievements
Rank 1
Veteran
Iron
Yan Moura asked on 16 Nov 2011, 04:55 PM
Hi,

I am trying to reproduce the demo existing on Map Shapes page (in XAML format) to C# code. Mostly wasn't so hard, but now I am stuck on getting the MapPolygon added to the Information Layer.

Here it is the original XAML sample (I supressed the CaptionTemplate part as I don't need it):

<telerik:RadMap x:Name="radMap" Width="600" Height="480">
    <telerik:InformationLayer>
        <telerik:MapPolygon Points="56,-100 56,-108 48,-108 48,-100" Fill="Green" Stroke="Red"
                  StrokeThickness="4" >
        </telerik:MapPolygon>
    </telerik:InformationLayer>
</telerik:RadMap>

And here my C# code:

InformationLayer MyInformationLayer = new InformationLayer();
 
LocationCollection MyLocationCollection = new LocationCollection();
MyLocationCollection.Add(new Location(56, -100));
MyLocationCollection.Add(new Location(56, -108));
MyLocationCollection.Add(new Location(48, -108));
MyLocationCollection.Add(new Location(48, -100));
 
MapPolygon MyMapPolygon = new MapPolygon();
MyMapPolygon.Points = MyLocationCollection;
MyMapPolygon.Fill = new SolidColorBrush(Colors.Green);
MyMapPolygon.Stroke = new SolidColorBrush(Colors.Red);
MyMapPolygon.StrokeThickness = 4;
 
// Now -- how to attach MyMapPolygon to MyInformationLayer?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Yan Moura
Top achievements
Rank 1
Veteran
Iron
answered on 16 Nov 2011, 06:46 PM
OK, I figured it out. For whose may have interest, it is:

MyInformationLayer.Items.Add(MyMapPolygon);
Tags
Map
Asked by
Yan Moura
Top achievements
Rank 1
Veteran
Iron
Answers by
Yan Moura
Top achievements
Rank 1
Veteran
Iron
Share this question
or