Esempio n. 1
0
 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));
 }
Esempio n. 2
0
 public static IEnumerable <DependencyObject> GetContainers(this ItemsControl control)
 {
     if (control == null)
     {
         throw new ArgumentNullException("control");
     }
     return(ItemsControlExtensions.GetContainersIterator <DependencyObject>(control));
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        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)))));
        }
Esempio n. 5
0
 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)));
 }