Map 控件深入学习

1. 加一个标记:

加标记,是地图中最常用的方法。它和bing map又有所不同,首先所在的命名空间不同;其次显示方式不同;但总之都是可以在模拟上运行的。

1
2
3
4
5
6
7
8
9
10
11
Pushpin pin = new Pushpin();
 
pin.Location = new GeoCoordinate(30.259497, 120.129798);
 
pin.Width = 200;
 
pin.Height = 200;
 
pin.Content = "test";
 
pin.Background = new SolidColorBrush(Colors.Red);


Map控件显示的标记

bing map控件显示的标记

2. 绘制多边型区域:

1
2
3
4
5
6
7
8
9
MapPolygon polygon = new MapPolygon();
 
polygon.Locations = new LocationCollection() { new GeoCoordinate(30.259497, 120.129798),
 
                                         new GeoCoordinate(30.359497, 120.329998),
 
                                         new GeoCoordinate(30.379497, 120.529798),
 
                                         new GeoCoordinate(30.389497, 120.729798) };


3. 绘制多边线:

1
2
3
4
5
6
7
8
9
10
11
12
13
MapPolyline polyline = new MapPolyline();
 
polyline.Stroke = new SolidColorBrush(Colors.Red);
 
polyline.Locations = new LocationCollection() {
 
                                          new GeoCoordinate(30.259497, 120.129798),
 
                                          new GeoCoordinate(30.289497, 120.120998)
 
 
 
                                       };


4.在地图上增加图片:

1
2
3
MapLayer imagelayer = new MapLayer();
 
imagelayer.AddChild(image, new GeoCoordinate(30.259497, 120.129798), PositionOrigin.BottomLeft);

你可能感兴趣的:(Map 控件深入学习)