public static IEnumerable <KeyValuePair <object, TContainer> > GetItemsAndContainers <TContainer>(this ItemsControl control) where TContainer : DependencyObject { if (control == null) { throw new ArgumentNullException("control"); } return(ItemsControlExtensions.GetItemsAndContainersIterator <TContainer>(control)); }
public static IEnumerable <DependencyObject> GetContainers(this ItemsControl control) { if (control == null) { throw new ArgumentNullException("control"); } return(ItemsControlExtensions.GetContainersIterator <DependencyObject>(control)); }
internal static void AddItem(this ItemsControl that, object item) { if (that.ItemsSource == null) { ItemsControlExtensions.InsertItem(that, that.Items.Count, item); } else { CollectionHelper.Add(that.ItemsSource, item); } }
public static ScrollViewer GetScrollHost(this ItemsControl control) { if (control == null) { throw new ArgumentNullException("control"); } Panel itemsHost = ItemsControlExtensions.GetItemsHost(control); if (itemsHost == null) { return((ScrollViewer)null); } return(Enumerable.FirstOrDefault <ScrollViewer>(Enumerable.OfType <ScrollViewer>((IEnumerable)Enumerable.Where <DependencyObject>(VisualTreeExtensions.GetVisualAncestors((DependencyObject)itemsHost), (Func <DependencyObject, bool>)(c => c != control))))); }
private static IEnumerable <TContainer> GetContainersIterator <TContainer>(ItemsControl control) where TContainer : DependencyObject { return(Enumerable.Select <KeyValuePair <object, TContainer>, TContainer>(ItemsControlExtensions.GetItemsAndContainers <TContainer>(control), (Func <KeyValuePair <object, TContainer>, TContainer>)(p => p.Value))); }