Esempio n. 1
0
        /// <summary>
        /// Override for clearing a container.
        /// </summary>
        /// <param name="element">The element dependency object.</param>
        /// <param name="item">The item object.</param>
        protected override void ClearContainerForItemOverride(DependencyObject element, object item)
        {
            base.ClearContainerForItemOverride(element, item);
            this.containersByItem.Remove(item);

            ISplitItemsControl splitItemsControl = item as ISplitItemsControl;

            if (splitItemsControl == null)
            {
                FrameworkElement frameworkElement = item as FrameworkElement;
                if (frameworkElement != null && !string.IsNullOrEmpty(CascadingListBoxGroup.GetCascadingListBoxName(frameworkElement)))
                {
                    splitItemsControl = frameworkElement.FindName(CascadingListBoxGroup.GetCascadingListBoxName(frameworkElement)) as ISplitItemsControl;
                }
            }

            if (splitItemsControl != null)
            {
                this.containersBySplitItemsControl.Remove(splitItemsControl);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Override for preparing the container.
        /// </summary>
        /// <param name="element">The element dependency object.</param>
        /// <param name="item">The item object.</param>
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            base.PrepareContainerForItemOverride(element, item);

            ContentPresenter container = element as ContentPresenter;

            this.containersByItem.Add(item, container);
            DependencyObject dependencyObject = item as DependencyObject;

            if (dependencyObject != null)
            {
                CascadingListBoxGroup.SetCascadingListBoxGroup(dependencyObject, this);
                LinkingWrapPanel.SetIsLinkedToNextChild(container, LinkingWrapPanel.GetIsLinkedToNextChild(dependencyObject));
                this.UpdateListVisibility(dependencyObject);
            }

#if SILVERLIGHT
            Canvas.SetZIndex(container, this.Items.Count - this.Items.IndexOf(item));
#endif
            ISplitItemsControl splitItemsControl = item as ISplitItemsControl;
            if (splitItemsControl == null)
            {
                FrameworkElement frameworkElement = item as FrameworkElement;

                if (frameworkElement != null && !string.IsNullOrEmpty(CascadingListBoxGroup.GetCascadingListBoxName(frameworkElement)))
                {
                    splitItemsControl = frameworkElement.FindName(CascadingListBoxGroup.GetCascadingListBoxName(frameworkElement)) as ISplitItemsControl;
                }
            }

            if (splitItemsControl != null)
            {
                CascadingListBoxGroup.SetCascadingListBoxGroup(splitItemsControl as DependencyObject, this);
                this.containersBySplitItemsControl.Add(splitItemsControl, container);
            }
        }