[]
        
(Showing Draft Content)

C1.WPF.LiveLinq.WpfExtensions.AsLive

AsLive Method

AsLive<T>(INotifyCollectionChanged)

Creates a view based on the specified INotifyCollectionChanged data source.

Declaration
public static View<T> AsLive<T>(this INotifyCollectionChanged source)
Parameters
Type Name Description
INotifyCollectionChanged source

The INotifyCollectionChanged data source to expose as a view.

Returns
Type Description
View<T>

A view that contains the same elements as the INotifyCollectionChanged data source.

Type Parameters
Name Description
T

The type of the elements in the view.

Remarks

Use this method to build views from existing data sources implementing INotifyCollectionChanged. The element type of this data source must implement INotifyPropertyChanged, see Using the built-in collection class IndexedCollection(T) (LiveLinq to Objects)|tag=Using_the_built_in_collection_class_IndexedCollectionT_LiveLinq_to_Objects.

The resulting view may have its elements ordered differently than they are ordered in the source. Correspondingly, views built on this resulting view (for example, if you filter it with Where) will not preserve the source order either. If you need to preserve the source order, consider using the other AsLive overload where you can specify to what extent you need the order to be preserved.

AsLive<T>(INotifyCollectionChanged, ViewOrder)

Creates a view based on the specified INotifyCollectionChanged data source.

Declaration
public static View<T> AsLive<T>(this INotifyCollectionChanged source, ViewOrder order)
Parameters
Type Name Description
INotifyCollectionChanged source

The INotifyCollectionChanged data source to expose as a view.

ViewOrder order

Specifies whether to preserve source item order.

Returns
Type Description
View<T>

A view that contains the same elements as the INotifyCollectionChanged data source.

Type Parameters
Name Description
T

The type of the elements in the view.

Remarks

Use this method to build views from existing data sources implementing INotifyCollectionChanged. The element type of this data source must implement INotifyPropertyChanged, see Using the built-in collection class IndexedCollection(T) (LiveLinq to Objects)|tag=Using_the_built_in_collection_class_IndexedCollectionT_LiveLinq_to_Objects.

If the order parameter specifies preserving item order, the order of items in the source is preserved, at a certain performance cost, in the resulting view and in views based on it (for example, if you filter it with Where).

Note that Join does not preserve source order. If you need to order a join result, use OrderBy after Join.

AsLive<T>(ObservableCollection<T>)

A typed specialization of the AsLive<T>(INotifyCollectionChanged) method.

Declaration
public static View<T> AsLive<T>(this ObservableCollection<T> source)
Parameters
Type Name Description
ObservableCollection<T> source

The ObservableCollection<T> to expose as a view.

Returns
Type Description
View<T>

A view that contains the same elements as the ObservableCollection<T>.

Type Parameters
Name Description
T

The type of the elements in the view.

AsLive<T>(ObservableCollection<T>, ViewOrder)

A typed specialization of the AsLive<T>(INotifyCollectionChanged, ViewOrder) method.

Declaration
public static View<T> AsLive<T>(this ObservableCollection<T> source, ViewOrder order)
Parameters
Type Name Description
ObservableCollection<T> source

The ObservableCollection<T> to expose as a view.

ViewOrder order

Specifies whether to preserve source item order.

Returns
Type Description
View<T>

A view that contains the same elements as the ObservableCollection<T>.

Type Parameters
Name Description
T

The type of the elements in the view.

AsLive<T>(ReadOnlyObservableCollection<T>)

A typed specialization of the AsLive<T>(INotifyCollectionChanged) method.

Declaration
public static View<T> AsLive<T>(this ReadOnlyObservableCollection<T> source)
Parameters
Type Name Description
ReadOnlyObservableCollection<T> source

The ReadOnlyObservableCollection<T> to expose as a view.

Returns
Type Description
View<T>

A view that contains the same elements as the ReadOnlyObservableCollection<T>.

Type Parameters
Name Description
T

The type of the elements in the view.

AsLive<T>(ReadOnlyObservableCollection<T>, ViewOrder)

A typed specialization of the AsLive<T>(INotifyCollectionChanged, ViewOrder) method.

Declaration
public static View<T> AsLive<T>(this ReadOnlyObservableCollection<T> source, ViewOrder order)
Parameters
Type Name Description
ReadOnlyObservableCollection<T> source

The ReadOnlyObservableCollection<T> to expose as a view.

ViewOrder order

Specifies whether to preserve source item order.

Returns
Type Description
View<T>

A view that contains the same elements as the ReadOnlyObservableCollection<T>.

Type Parameters
Name Description
T

The type of the elements in the view.