1
그래서 난 지금은 "A"컨트롤을 구성 요소 이름을 제거 할 그리고 난 다음 코드 항상 어떤요소의 모든 하위 요소에 액세스 할 수 없습니까?
int c = myMap.Children.Count;
for (int i = 0; i < c; i++)
{
if(myMap.Children.ElementAt(i) is Image)
{
var z = myMap.Children.ElementAt(i) as Image;
if(z.Name.Equals("a"))
{
myMap.Children.Remove(myMap.Children.ElementAt(i));
}
}
}
그러나 사용하고이
foreach (var res in results)
{
if (res.geometry.location != null)
{
var pushpin = new Image();
pushpin.Name = "a";
BasicGeoposition bs = new BasicGeoposition { Latitude = res.geometry.location.lat, Longitude = res.geometry.location.lng };
pushpin.Source = new BitmapImage(uri);
pushpin.Height = 50;
pushpin.Width = 50;
myMap.Children.Add(pushpin);
MapControl.SetLocation(pushpin, new Geopoint(bs));
}
}
같은지도 제어에 몇 가지 요소를 추가하고 요소가 제거되지 않습니다. 예를 들어 자식 수는 21이되지만 루프는 10 회만 반복됩니다. 어떻게이 문제를 해결할 수 있습니까?
루프 백 워드. 요소 1보다 요소 2를 제거하면 요소 2는 1이되고 요소 3은 2가됩니다. 자 이제 루프는 원래 2가 아닌 요소 2를 테스트합니다. – GuidoG
올바른 태그를 사용하십시오. 이 질문은 모든 현재 태그와 관련이 없습니다. –