Table of Contents

Class Image

Namespace
Icy.UI.Controls
Assembly
IcyUI.dll

Displays a single IImage (e.g. an ImageBrush or NinePatchImageBrush), sized to Size unless overridden by an explicit Width/Height.

public class Image : UIElement, INotifyPropertyChanging, IBindingTarget, INotifyPropertyChanged, INotifyFocusChanged
Inheritance
Image
Implements
Inherited Members
Extension Methods

Properties

Source

Gets or sets the image to display.

public IImage? Source { get; set; }

Property Value

IImage

Methods

ArrangeContent()

Handles custom arrange logic when overridden in any UIElement instance.

protected override void ArrangeContent()

Remarks

This method is called during the arrange pass to position and size the element's content within its final bounds. The element's position and size are already determined by the layout system and available in the ActualBounds property.

When implementing this method:

  • Position child elements within the available space;
  • Respect the element's padding when positioning content;
  • Handle any content-specific layout requirements;
  • Call Arrange() on child elements if needed.

MeasureContent()

Handles custom measure logic when overridden in any UIElement instance.

protected override Size MeasureContent()

Returns

Size

Size recommended to display the UIElement.

Remarks

This method is called during the measure pass to determine the desired size of the element. The returned size should represent the natural size of the element's content, without considering any constraints, margins, or padding.

When implementing this method:

  • Return the natural size needed to display the content;
  • Do not include padding, margins, or borders in the returned size;
  • Consider the content's actual dimensions (e.g., text length, image size);
  • Return Empty if the element has no content.

OnRender(IRenderContext)

Handles custom render logic when overridden in any UIElement instance.

protected override void OnRender(IRenderContext context)

Parameters

context IRenderContext

The context to render with.