0
나는 사용자에게 wp7 앱의 빙지도에서 여러 개의 압핀을보고 싶습니다. maplayer를 사용하여 압핀 클러스터를 만들었지 만 cs 파일 자체에서 해당 압핀에 이미지를 동적으로 추가 할 수 없었습니다. 그건 그렇고, xaml에서 압정 컨트롤을 사용하지 않았습니다. 루프를 반복하는 동안 압핀 개체를 추가하는 것뿐입니다. 나는 또한 이미지 소스를 제공하기 위해 이미지 브러시 속성을 사용하여 시도동적으로 고정 핀에 이미지를 제공하는 방법 #
maplayer layer = new maplayer();
watcher.start();
for (int i = 0; i < lst.count; i++)
{
Pushpin mypin = new Pushpin();
watcher.Position.Location.Latitude = Convert.ToDouble(lst[i].Latitude);
watcher.Position.Location.Longitude=Convert.ToDouble(lst[i].Longitude);
}
GeoCoordinate geo = new GeoCoordinate(watcher.Position.Location.Latitude, watcher.Position.Location.Longitude);
mypin.Location = geo;
mypin.Background = new SolidColorBrush(Colors.Gray);
mypin.Foreground = new SolidColorBrush(Colors.White);
mypin.Content = "My location";
layer.AddChild(mypin, mypin.Location);
}
map1.SetView(watcher.Position.Location, Status == true ? 5.0 : 3.0);
map1.Children.Add(layer);
watcher.stop();
압정하지만 압정 자체가 보이지 않는 이동하기 :
여기 내 코드입니다. 이 같은
:
ImageBrush ib = new ImageBrush();
ib.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"Images/push.png", UriKind.Relative));
mypin.Background = ib;
날이에 도와주세요. xaml 쪽에서 압핀에 datatemplate을 변경/추가하지 않고이 작업이 필요합니다.