Exemplo n.º 1
0
        private void DockPositionPropertyChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            Debug.Assert(!IsIdle);

            if (e.OldValue != e.NewValue && sender is DockableCollection dockableCollection && InternalChildren.Contains(dockableCollection))
            {
                LayoutContext layoutContext = GetLayoutContext(dockableCollection);
                if (layoutContext != null)
                {
                    //  A likely scenario is the collection was created, added to the Dock's Items collection, then
                    //  the attached DockPosition property was set.  We may or may not, have already arranged the
                    //  element.
                    //
                    //  A less likely scenario is the user simply set DockPosition to a new value for whatever reason.

                    layoutContext.Remove();
                    InsertByDockPosition(layoutContext);
                    layoutContext.InvalidatePositioning(LayoutContext.PositionClasses.All);
                    InvalidateArrange();
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
        {
            using (new Activity(this))
            {
                base.OnVisualChildrenChanged(visualAdded, visualRemoved);

                if (visualAdded is DockableCollection dockableCollection)
                {
                    AddChild(dockableCollection);
                }

                if (visualRemoved is DockableCollection dockableCollection1)
                {
                    LayoutContext layoutContext = GetLayoutContext(dockableCollection1);
                    layoutContext.Remove();
                    LayoutContexts.Remove(layoutContext);
                    SetLayoutContext(dockableCollection1, null);
                }

                _maximumHorizontalDepth = null;
                _maximumVerticalDepth   = null;
                InvalidateArrange();
            }
        }