ฉันกำลังพยายามเพิ่มหมุดหลายอันลงในแผนที่ ซึ่งจะหายไปเมื่อคุณซูมออกมากพอ เพื่อทำให้หมุดมีขนาดเล็กลงจนไม่แสดงผลอีกต่อไป
ฉันจัดการเพื่อให้ได้เอฟเฟกต์นี้ด้วยรหัสต่อไปนี้:
MapPolygon shape = new MapPolygon();
GeoCoordinateCollection boundingLocations = CreateCircle(geoCoordinate, 0.1);
shape.Path = boundingLocations;
shape.FillColor = Color.FromArgb(0x55, 0xFF, 0xFF, 0x00);
shape.StrokeColor = Color.FromArgb(0xFF, 0xFF, 0x00, 0xFF);
shape.StrokeThickness = 4;
mapToDrawOn.MapElements.Add(shape);
แต่สิ่งที่ฉันต้องการทำจริงๆ คือเติมรูปหลายเหลี่ยมด้วยรูปภาพที่กำหนดเอง รูปภาพจะต้องวางอยู่ในจุดเฉพาะของแผนที่ และเชื่อมโยงขนาดของภาพกับระดับการซูม (เหมือนในตัวอย่างด้านบน) นี่คือโค้ดที่ฉันพยายามใช้:
MapLayer layer = new MapLayer();
MapOverlay overlay = new MapOverlay();
Polygon polygon = new Polygon();
polygon.Points.Add(new Point(0, 0));
polygon.Points.Add(new Point(0, 75));
polygon.Points.Add(new Point(25, 0));
BitmapImage arrImg =
new BitmapImage(new Uri("/Images/arrow.png", UriKind.RelativeOrAbsolute));
ImageBrush imgBrush = new ImageBrush();
imgBrush.ImageSource = arrImg;
polygon.Fill = imgBrush;
overlay.Content = polygon;
//geoCoordinate is the argument of a method
overlay.GeoCoordinate = geoCoordinate;
layer.Add(overlay);
mapToDrawOn.Layers.Add(layer);
มันไม่ทำงาน ภาพจะปรากฏ ณ จุดใดจุดหนึ่งของโลก แต่เมื่อผมซูมออก ภาพจะคงขนาดไว้ ฉันเชื่อว่าปัญหาเกิดจากการไม่มีสี่เหลี่ยมผืนผ้าบางส่วนที่จำกัดรูปหลายเหลี่ยม แต่ฉันไม่พบสิ่งใดที่จะเริ่มต้น กรุณาช่วย.