Table of Contents

Class ComboBox

Namespace
Icy.UI.Controls
Assembly
IcyUI.dll

A Selector with an editable text field that live-filters items by a case-insensitive Contains match against DisplayMemberPath - selection-only, not free text entry (see the class remarks on ItemsSource).

public class ComboBox : Selector, INotifyPropertyChanging, IBindingTarget, INotifyPropertyChanged, INotifyFocusChanged, IContainerLayout, IVirtualizingScrollInfo
Inheritance
ComboBox
Implements
Inherited Members
Extension Methods

Remarks

ItemsSource shadows (does not override - ItemsSource isn't virtual) the inherited property, the same way Padding already shadows Padding: this control's real, full source is held here, and the base ItemsSource is kept pointed at whatever subset currently matches the filter text. SelectedItem/SelectedIndex reflect the filtered subset only while actively filtering - full selection is restored on every commit path (a matching Enter, or a revert via Escape/non-matching Enter).

Constructors

ComboBox()

Initializes a new instance of the ComboBox class.

public ComboBox()

Properties

ItemsSource

Gets or sets the collection this control's items are drawn from - shadows ItemsSource to apply Text's filter on top.

public IEnumerable? ItemsSource { get; set; }

Property Value

IEnumerable

Remarks

Because the base ItemsSource is only ever pointed at a throwaway filtered snapshot, ItemsControl's own INotifyCollectionChanged observation never sees the real collection - so this setter subscribes to it here instead, re-running the filter whenever it changes (see OnDetached() for the matching unsubscribe).

Methods

OnActivate()

Invoked by Canvas for an activation press (Enter, gamepad A) while this element or one of its descendants has focus.

protected override bool OnActivate()

Returns

bool

true to claim the press; Canvas then stops calling further ancestors. The base implementation returns false.

Remarks

Closed: opens the popup. Open with a valid HighlightedIndex: commits it to SelectedIndex and closes. Always claims the press.

OnDetached()

Raises the Detached event.

protected override void OnDetached()

Remarks

Propagates null to every element in GetVisualChildren(), mirroring OnAttached() - see its remarks.

OnNavigationCloseModal(object?, EventArgs)

Handles Escape/gamepad-B while the focus gate is focused - closes the popup without changing SelectedIndex.

protected override void OnNavigationCloseModal(object? sender, EventArgs e)

Parameters

sender object

The source of the event.

e EventArgs

The EventArgs instance containing the event data.