private void OnFlightRouteDelete(object sender, FlightRouteEventArgs args) { foreach (UIElement uiElement in FlightRoutePanelContainer.Children) { FlightRouteControlTextBlock uiTextBlock = uiElement as FlightRouteControlTextBlock; if (uiTextBlock != null && uiTextBlock.FlightRouteName.Text.Equals(args.FlightPlanName)) { FlightRoutePanelContainer.Children.Remove(uiTextBlock); break; } } }
private void OnFlightRouteDelete(object sender, FlightRouteEventArgs args) { if (flightRouteUIElementsMap.ContainsKey(args.FlightPlanName)) { List <UIElement> uiElements = flightRouteUIElementsMap[args.FlightPlanName]; foreach (UIElement element in uiElements) { BingMap.Children.Remove(element); } flightRouteUIElementsMap.Remove(args.FlightPlanName); } }