/// <summary> /// When overridden in a derived class, measures the size in layout required for child elements and /// determines a size for the <see cref="T:System.Windows.FrameworkElement" />-derived class. /// </summary> /// <param name="availableSize">The available size that this element can give to child elements.</param> /// <returns> /// The size that this element determines it needs during layout, based on its calculations of child element sizes. /// </returns> protected override Size MeasureOverride(Size availableSize) { if (double.IsInfinity(availableSize.Width)) { Debug.Assert(false, "Infinite width is not supported"); availableSize = new Size(100, availableSize.Height); } if (double.IsInfinity(availableSize.Height)) { Debug.Assert(false, "Infinite height is not supported"); availableSize = new Size(availableSize.Width, 100); } _children.AvailableWidth = availableSize.Width; var measurer = new SmoothPanelMeasurer(this, availableSize); measurer.Measure(); return(availableSize); }
/// <summary> /// When overridden in a derived class, measures the size in layout required for child elements and /// determines a size for the <see cref="T:System.Windows.FrameworkElement" />-derived class. /// </summary> /// <param name="availableSize">The available size that this element can give to child elements.</param> /// <returns> /// The size that this element determines it needs during layout, based on its calculations of child element sizes. /// </returns> protected override Size MeasureOverride(Size availableSize) { if (double.IsInfinity(availableSize.Width)) { Debug.Assert(false, "Infinite width is not supported"); availableSize = new Size(100, availableSize.Height); } if (double.IsInfinity(availableSize.Height)) { Debug.Assert(false, "Infinite height is not supported"); availableSize = new Size(availableSize.Width, 100); } _children.AvailableWidth = availableSize.Width; var measurer = new SmoothPanelMeasurer(this, availableSize); measurer.Measure(); return availableSize; }