예제 #1
0
        /// <summary>
        /// Override for the Arrange Layout Phase
        /// </summary>
        /// <param name="finalSize">Available size provided by the FluidWrapPanel</param>
        /// <returns>Size taken up by the Panel</returns>
        protected override Size ArrangeOverride(Size finalSize)
        {
            if (layoutManager == null)
            {
                layoutManager = new FluidLayoutManager();
            }

            // Initialize the LayoutManager
            layoutManager.Initialize(finalSize.Width, finalSize.Height, ItemWidth, ItemHeight, Orientation);

            bool isEasingRequired = !isInitializeArrangeRequired;

            // If the children are newly added, then set their initial location before the panel loads
            if ((isInitializeArrangeRequired) && (this.Children.Count > 0))
            {
                InitializeArrange();
                isInitializeArrangeRequired = false;
            }

            // Update the Layout
            UpdateFluidLayout(isEasingRequired);

            // Return the size taken up by the Panel's Children
            return(layoutManager.GetArrangedSize(fluidElements.Count, finalSize));
        }
예제 #2
0
 /// <summary>
 /// Ctor
 /// </summary>
 public FluidWrapPanel()
 {
     fluidElements = new List <UIElement>();
     layoutManager = new FluidLayoutManager();
     isInitializeArrangeRequired = true;
 }