/// <summary> /// Measure the layout size required to arrange all elements. /// </summary> /// <param name="availableSize">Available size that can be given to elements.</param> /// <returns>Size the layout determines it needs based on child element sizes.</returns> protected override Size MeasureOverride(Size availableSize) { // The collection of children might have changed, so resync ResyncStateDictionary(); // Use default layout so that any children not handled by the layout definitions is still processed _defaultLayout.MeasureChildren(string.Empty, this, _stateDict, Children, availableSize); // Ask the layout strategy to measure the elements for us return(Layouts.MeasureChildren(LayoutId, this, _stateDict, Children, availableSize)); }
/// <summary> /// Measure the layout size required to arrange all elements. /// </summary> /// <param name="availableSize">Available size that can be given to elements.</param> /// <returns>Size the layout determines it needs based on child element sizes.</returns> protected override Size MeasureOverride(Size availableSize) { // To ensure correct operation when transitioning between being an items host and // not being an items host (and vica versa) we need to ask for the InternalChildren // property. The base class implementation will automatically handle creating the // item container generator and pulling it down again. int c = InternalChildren.Count; // Delegate calculation to the panel layout instance if (_children != null) { // Use default layout so that any children not handled by the layout definitions is still processed _defaultLayout.MeasureChildren(string.Empty, this, _stateDict, _children.CompoundElements, availableSize); // Ask the layout strategy to measure the elements for us return(Layouts.MeasureChildren(LayoutId, this, _stateDict, _children.CompoundElements, availableSize)); } else { return(new Size()); } }