CollectionView<T> Class
Defines a managed view over a collection with capability to sort, group, filter, and limit the number of items in the view.
public class CollectionView<T> : ICollectionView<T>, ICollectionView
- Type Parameters:
-
T
-The type.
- Inheritance:
- object object
- Implements:
- ICollectionView<T> ICollectionView
Remarks
This experimental class is subject to breaking changes and should only be used in conjunction with Actipro controls in the manner directed.
Constructors
CollectionView(IEnumerable<T>)
Initializes an instance of the class.
public CollectionView(IEnumerable<T> collection)
Parameter | Type | Description |
---|---|---|
collection | IEnumerable<T> | The source collection to be managed by the view. |
Properties
Count
Gets the number of elements contained in the ICollection<T>.
public int Count { get; }
Property Value
- int:
The number of elements contained in the ICollection<T>.
Filter
A filter used to determine which items are included in the view.
GroupDescriptions
Defines grouping to be applied to the view.
public ObservableCollection<GroupDescription<T>> GroupDescriptions { get; }
Property Value
Remarks
Only a single group is supported at this time.
Groups
The groups of items including by the view of this collection.
public ObservableCollection<CollectionViewGroup> Groups { get; }
Property Value
HasFilter
Indicates if the view has defined a filter.
HasGroups
Indicates if the view has defined any groups.
MaxItemCount
The maximum number of items to be included in the view.
SortDescriptions
Defines the order in which items are sorted for the view.
public ObservableCollection<SortDescription<T>> SortDescriptions { get; }
Property Value
Methods
Contains(T)
Determines whether the ICollection<T> contains a specific value.
public bool Contains(T value)
Parameter | Type | Description |
---|---|---|
value | T |
Returns
- bool:
true
ifitem
is found in the ICollection<T>; otherwise,false
.
GetGroupNames(bool)
Gets the name of the available groups, optionally included groups that are excluded by the current filter.
public IEnumerable<string?> GetGroupNames(bool ignoreFilter)
Parameter | Type | Description |
---|---|---|
ignoreFilter | bool | When |
Returns
GetItemAt(int)
Gets the item at the specified index of the view.
public virtual T GetItemAt(int index)
Parameter | Type | Description |
---|---|---|
index | int | The index of the item. |
Returns
- T
IndexOf(T)
Gets the index of the item within the view.
public virtual int IndexOf(T item)
Parameter | Type | Description |
---|---|---|
item | T | The item to examine. |
Returns
- int:
The index of the item within the view, or
-1
if the item could not be found.
PassesFilter(T)
Tests if an item passes the filter.
protected bool PassesFilter(T item)
Parameter | Type | Description |
---|---|---|
item | T | The item to examine. |
Returns
- bool:
true
if the item passes the filter and should be included in the view; otherwise,false
.
Refresh()
Refreshes the view.
public void Refresh()
ResolveGroupName(T)
Resolves the group name, if any, that applies to the given item.
public string? ResolveGroupName(T item)
Parameter | Type | Description |
---|---|---|
item | T | The item to examine. |
Returns
- string:
The group name, or
null
if a group name is not available.
Events
CollectionChanged
Occurs when the collection changes.
public event NotifyCollectionChangedEventHandler? CollectionChanged
Event Type
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()