In This Article

ZeroSizeContentControl Class

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

public class ZeroSizeContentControl : ContentControl, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient, IAddChild
Inheritance:
System.Object System.Windows.Threading.DispatcherObject System.Windows.DependencyObject System.Windows.Media.Visual System.Windows.UIElement System.Windows.FrameworkElement System.Windows.Controls.Control System.Windows.Controls.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 System.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

System.Boolean:

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

System.Boolean:

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

System.Windows.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 System.Windows.FrameworkElement derived class.

protected override Size ArrangeOverride(Size arrangeBounds)
Parameter Type Description
arrangeBounds System.Windows.Size

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

Returns

System.Windows.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 System.Windows.FrameworkElement-derived class.

protected override Size MeasureOverride(Size availableSize)
Parameter Type Description
availableSize System.Windows.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

System.Windows.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

Inherited Members

  • System.Object.ToString()
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetHashCode()
  • System.Object.GetType()
  • System.Object.MemberwiseClone()

Extension Methods