示例#1
0
        /// <summary>
        /// Position child elements according to already provided size.
        /// </summary>
        /// <param name="finalSize">Size that layout should use to arrange child elements.</param>
        /// <returns>Size used by the panel.</returns>
        protected override Size ArrangeOverride(Size finalSize)
        {
            // Implement any ClipToBounds property setting
            ImplementClipToBounds(finalSize);

            // Grab the collection of appropriate elements
            ICollection elements = MetaChildren;

            // Ask the panel layout to calculate the target display rectangles for elements
            Layouts.TargetChildren(LayoutId, this, _stateDict, elements, finalSize);

            // Ask the chain of animation handlers to update animation state and elements
            bool needAnimating = AnimateChildren(_stateDict, elements);

            // Faster perf to only set the IsAnimating when we notice a change
            if (needAnimating != IsAnimating)
            {
                IsAnimating = needAnimating;
            }

            // Finally ask the panel layout to arrange elements in animation determined positions
            return(Layouts.ArrangeChildren(LayoutId, this, _stateDict, elements, finalSize));
        }