Table of Contents

Class ListView<T>

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

Provides a scrollable list of data where each item can be activated to perform an action, with a strongly-typed Value property that returns the selected object of type T from the underlying ObservableCollection<T>.

public class ListView<T> : ListView, IDisposable, ISupportInitializeNotification, ISupportInitialize, IDesignable, IValue<int?>, IValue<T>, IValue

Type Parameters

T

The type of items in the collection.

Inheritance
ListView<T>
Implements
Inherited Members
Extension Methods

Remarks

ListView<T> extends ListView by implementing IValue<TValue>. The Value property returns the currently selected object of type T rather than the selected index.

All ListView functionality (rendering, marking, keyboard navigation, key and mouse bindings) is inherited unchanged. Use SetSource(ObservableCollection<T>?) to provide the typed source collection.

The base Value (index-based, IValue<TValue> with T = int?) remains accessible by casting to ListView or IValue<int?>.

Constructors

ListView()

Initializes a new instance of ListView<T>.

Properties

Index

Gets or sets the zero-based index of the currently selected item.

SelectedItem

Gets or sets the currently selected object. This is a convenience property that is an alias for Value.

Value

Gets or sets the currently selected item as a T object.

Methods

Dispose(bool)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

OnValueChanged(ValueChangedEventArgs<T?>)

Called when Value has changed.

OnValueChanging(ValueChangingEventArgs<T?>)

Called when Value is about to change.

SetSource(ObservableCollection<T>?)

Sets the source collection and updates the display.

Events

ValueChanged

Raised when Value has changed.

ValueChangedUntyped

Raised when Value has changed, providing the value as an un-typed object.

ValueChanging

Raised when Value is about to change. Set Handled to true to cancel the change.