BindableList<TItem>

A list source: any list literal, or a Bind(...) expression.

Changes animate when the list is an ObservableCollection.

[CollectionBuilder(typeof(BindableList), nameof(BindableList.Create))] public readonly struct BindableList<TItem> : IReadOnlyList<TItem>
Type parameterSummary
TItemThe element type of the list.

Properties

Count

The number of current items. A binding that has not been evaluated yet is empty.

Type: int

public int Count { get; }

this

Gets a current item by index.

Type: TItem

public TItem this[int index] { get; }
ParameterSummary
int index

Methods

Add

Adds an item when the wrapped source is mutable.

Bound and read-only sources cannot be mutated through this wrapper.

public void Add(
  TItem item)
ParameterSummary
TItem item

GetEnumerator

Enumerates the current list value.

public IEnumerator<TItem> GetEnumerator()

Returns

  • IEnumerator<TItem>: An enumerator over the current items.

Operators

Implicit BindableList<TItem>(BindingExpression<IVirtualizedList<TItem>?>)

Wraps an active binding to a virtualized list source.

public static implicit operator BindableList<TItem>(
  BindingExpression<IVirtualizedList<TItem>?> expression)
ParameterSummary
BindingExpression<IVirtualizedList<TItem>?> expressionThe evaluation rule for the property.

Returns

  • BindableList<TItem>: A virtualized list source using the binding expression.

Implicit BindableList<TItem>(BindingExpression<IReadOnlyList<TItem>?>)

Wraps an active binding to a list-typed source property.

public static implicit operator BindableList<TItem>(
  BindingExpression<IReadOnlyList<TItem>?> expression)
ParameterSummary
BindingExpression<IReadOnlyList<TItem>?> expressionThe evaluation rule for the property.

Returns

  • BindableList<TItem>: A list source using the binding expression.

Implicit BindableList<TItem>(BindingExpression<List<TItem>?>)

Wraps an active binding to a List-typed source property.

public static implicit operator BindableList<TItem>(
  BindingExpression<List<TItem>?> expression)
ParameterSummary
BindingExpression<List<TItem>?> expressionThe evaluation rule for the property.

Returns

  • BindableList<TItem>: A list source using the binding expression.

Implicit BindableList<TItem>(BindingExpression<ObservableCollection<TItem>?>)

Wraps an active binding to an ObservableCollection-typed source property.

public static implicit operator BindableList<TItem>(
  BindingExpression<ObservableCollection<TItem>?> expression)
ParameterSummary
BindingExpression<ObservableCollection<TItem>?> expressionThe evaluation rule for the property.

Returns

  • BindableList<TItem>: A live list source using the binding expression.

Implicit BindableList<TItem>(BindingExpression<TItem?>)

Wraps an active binding to an array-typed source property.

public static implicit operator BindableList<TItem>(
  BindingExpression<TItem[]?> expression)
ParameterSummary
BindingExpression<TItem?> expressionThe evaluation rule for the property.

Returns

  • BindableList<TItem>: A list source using the binding expression.

Implicit BindableList<TItem>(List<TItem>)

Wraps a list literal.

public static implicit operator BindableList<TItem>(
  List<TItem> value)
ParameterSummary
List<TItem> valueThe items to show.

Returns

Implicit BindableList<TItem>(ObservableCollection<TItem>)

Wraps an observable collection, whose changes animate into place.

public static implicit operator BindableList<TItem>(
  ObservableCollection<TItem> value)
ParameterSummary
ObservableCollection<TItem> valueThe live items to show.

Returns

  • BindableList<TItem>: A live list source containing the collection.

Implicit BindableList<TItem>(TItem)

Wraps an array literal.

public static implicit operator BindableList<TItem>(
  TItem[] value)
ParameterSummary
TItem valueThe items to show.

Returns