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.

For detailed documentation on this control's features and how to use them, please see the ZeroSizeContentControl documentation topic.

Constructors

ZeroSizeContentControl()

Initializes an instance of the ZeroSizeContentControl class.

public ZeroSizeContentControl()

ZeroSizeContentControl(object)

Initializes an instance of the ZeroSizeContentControl class.

public ZeroSizeContentControl(object content)
Parameter Type Description
content object

The object to use as the content.

Properties

HasHeight

Gets or sets 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

Gets or sets 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

Gets 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:

The ideal System.Windows.Size of the control.

Methods

ArrangeOverride(Size)

When overridden in a derived class, positions child elements and determines a size for a FrameworkElement derived class.

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

The final area within the parent that this element should use to arrange itself and its children.

Returns

Size:

The actual size used.

MeasureOverride(Size)

When overridden in a derived class, measures the size in layout required for child elements and determines a size for the FrameworkElement-derived class.

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

The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.

Returns

Size:

The size that this element determines it needs during layout, based on its calculations of child element sizes.

Fields

HasHeightProperty

Identifies the HasHeight dependency property. This field is read-only.

public static readonly DependencyProperty HasHeightProperty

HasWidthProperty

Identifies the HasWidth dependency property. This field is read-only.

public static readonly DependencyProperty HasWidthProperty

IdealSizeProperty

Identifies the IdealSize dependency property. This field is read-only.

public static readonly DependencyProperty IdealSizeProperty