Table of Contents

Class Icon

Namespace
Icy.UI.Controls
Assembly
IcyUI.dll

Draws one small, stroke-only vector glyph (see Kind) scaled to fill this element's own bounds - a minimal alternative to a full path/shape markup language, covering exactly the iconography simple themed controls need (a checkbox's check, a dropdown's chevron) without a bitmap asset.

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

Remarks

Renders via the existing DrawPolygon(IRenderContext, Vector2, Vector2[], Color, float) primitive (the same one the debug-overlay system already uses), not a new rendering primitive.

Properties

Kind

Gets or sets which glyph this icon draws.

public IconKind Kind { get; set; }

Property Value

IconKind

Stroke

Gets or sets the brush the glyph is drawn with. Only a SolidColorBrush is actually honored today - anything else falls back to White, since the underlying ShapesExtensions line-drawing primitives only accept a flat Color.

public IBrush Stroke { get; set; }

Property Value

IBrush

StrokeThickness

Gets or sets the line thickness the glyph is drawn with, in pixels.

public float StrokeThickness { get; set; }

Property Value

float

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.