PrimitiveShape.MeasureOverride Method

Provides the behavior for the Measure portion of Silverlight layout pass. Classes can override this method to define their own Measure pass behavior.

Namespace: Microsoft.Expression.Shapes
Assembly: Microsoft.Expression.Drawing (in microsoft.expression.drawing.dll)

Syntax

'Declaration
Protected Overrides Function MeasureOverride ( _
    availableSize As Size _
) As Size
'Usage
Dim availableSize As Size
Dim returnValue As Size

returnValue = Me.MeasureOverride(availableSize)
protected override Size MeasureOverride (
    Size availableSize
)
protected:
virtual Size MeasureOverride (
    Size availableSize
) override
protected Size MeasureOverride (
    Size availableSize
)
protected override function MeasureOverride (
    availableSize : Size
) : Size

Parameters

availableSize

The available size that this object can provide to child objects. Infinity (PositiveInfinity) can be specified as a value to indicate that the object will size to whatever content is available.

Return Value

The size that this object determines it requires during layout, based on its calculations of child object allotted sizes, or possibly on other considerations such as fixed container size.

Remarks

In WPF, measure override works from Shape.DefiningGeometry which is not always as expected see bug 99497 for details where WPF is not having correct measure by default. In Silverlight, measure override on Path does not work the same as primitive shape works. We should return the smallest size this shape can correctly render without clipping. By default a shape can render as small as a dot, therefore returning the strokethickness.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

PrimitiveShape Class
PrimitiveShape Members
Microsoft.Expression.Shapes Namespace