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();
                }
            }
        }