Ejemplo n.º 1
0
        /// <summary>
        /// Updates the DesiredSize of a UIElement. Typically, objects that implement custom layout for their
        /// layout children call this method from their own MeasureOverride implementations to form a recursive layout update.
        /// </summary>
        /// <param name="availableSize">
        /// The available space that a parent can allocate to a child object. A child object can request a larger
        /// space than what is available; the provided size might be accommodated if scrolling or other resize behavior is
        /// possible in that particular container.
        /// </param>
        /// <returns>The measured size.</returns>
        /// <remarks>
        /// Under Uno.UI, this method should not be called during the normal layouting phase. Instead, use the
        /// <see cref="MeasureElement(View, Size)"/> methods, which handles native view properly.
        /// </remarks>
        public override void Measure(Size availableSize)
        {
            if (double.IsNaN(availableSize.Width) || double.IsNaN(availableSize.Height))
            {
                throw new InvalidOperationException($"Cannot measure [{GetType()}] with NaN");
            }

            _layouter.Measure(availableSize);
            OnMeasurePartial(availableSize);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Updates the DesiredSize of a UIElement. Typically, objects that implement custom layout for their
 /// layout children call this method from their own MeasureOverride implementations to form a recursive layout update.
 /// </summary>
 /// <param name="availableSize">
 /// The available space that a parent can allocate to a child object. A child object can request a larger
 /// space than what is available; the provided size might be accommodated if scrolling or other resize behavior is
 /// possible in that particular container.
 /// </param>
 /// <returns>The measured size.</returns>
 /// <remarks>
 /// Under Uno.UI, this method should not be called during the normal layouting phase. Instead, use the
 /// <see cref="MeasureElement(View, Size)"/> methods, which handles native view properly.
 /// </remarks>
 public override void Measure(Size availableSize)
 {
     _layouter.Measure(availableSize);
     OnMeasurePartial(availableSize);
 }