public static IEnumerable<CardControl> GetCardControls(GroupControl ctrl) { if (IsEmpty()) yield break; var groupCards = ctrl.Group.Cards; var generator = ctrl.GetItemContainerGenerator(); for (int i = 0; i < groupCards.Count; ++i) if (groupCards[i].Selected) { var container = generator.ContainerFromIndex(i); var cardCtrl = (CardControl)System.Windows.Media.VisualTreeHelper.GetChild(container, 0); yield return cardCtrl; } }
public static IEnumerable<CardControl> GetCardControls(GroupControl ctrl) { if (IsEmpty()) yield break; ObservableCollection<Card> groupCards = ctrl.Group.Cards; ItemContainerGenerator generator = ctrl.GetItemContainerGenerator(); for (int i = 0; i < groupCards.Count; ++i) if (groupCards[i].Selected) { DependencyObject container = generator.ContainerFromIndex(i); var cardCtrl = (CardControl) VisualTreeHelper.GetChild(container, 0); yield return cardCtrl; } }
public static IEnumerable <CardControl> GetCardControls(GroupControl ctrl) { if (IsEmpty()) { yield break; } ObservableCollection <Card> groupCards = ctrl.Group.Cards; ItemContainerGenerator generator = ctrl.GetItemContainerGenerator(); for (int i = 0; i < groupCards.Count; ++i) { if (groupCards[i].Selected) { DependencyObject container = generator.ContainerFromIndex(i); var cardCtrl = (CardControl)VisualTreeHelper.GetChild(container, 0); yield return(cardCtrl); } } }