In This Article

ZeroSizeContentControl Class

Represents a ContentControl that can return a zero width or height during its measuring pass.

public class ZeroSizeContentControl : ContentControl
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl object

Remarks

Use the HorizontalContentAlignment and VerticalContentAlignment properties to align the content with no width or height respectively.

Constructors

ZeroSizeContentControl()

Initializes an instance of the class.

public ZeroSizeContentControl()

ZeroSizeContentControl(object)

Initializes an instance of the class.

public ZeroSizeContentControl(object content)
Parameter Type Description
content object

The object to use as the content.

Properties

HasHeight

Indicates whether the content's height should be used in the measuring pass.

public bool HasHeight { get; set; }

Property Value

bool:

true if the content's height should be used in the measuring pass; otherwise, false. The default value is true.

HasWidth

Indicates whether the content's width should be used in the measuring pass.

public bool HasWidth { get; set; }

Property Value

bool:

true if the content's width should be used in the measuring pass; otherwise, false. The default value is true.

IdealSize

The ideal System.Windows.Size of the control, since the DesiredSize will not represent the true desired size.

public Size IdealSize { get; }

Property Value

Size

Methods

ArrangeOverride(Size)

Called to arrange and size the content of a Control object.

protected override Size ArrangeOverride(Size arrangeBounds)
Parameter Type Description
arrangeBounds Size

The computed size that is used to arrange the content.

Returns

Size:

The size of the control.

MeasureOverride(Size)

Called to remeasure a control.

protected override Size MeasureOverride(Size availableSize)
Parameter Type Description
availableSize Size

Returns

Size:

The size of the control, up to the maximum specified by constraint.

Fields

HasHeightProperty

Defines the HasHeight property.

public static readonly DependencyProperty HasHeightProperty

HasWidthProperty

Defines the HasWidth property.

public static readonly DependencyProperty HasWidthProperty

IdealSizeProperty

Defines the IdealSize property.

public static readonly DependencyProperty IdealSizeProperty

Extension Methods