Class GridSelectedObjectsBase<T>
A collection object that holds ISelectable, IComparable objects for a ISupportsRecordSelection object like GridTreeControl.
Implements
Namespace: Syncfusion.Windows.Controls.Grid
Assembly: Syncfusion.Grid.Wpf.dll
Syntax
public class GridSelectedObjectsBase<T> : Object, IEnumerable<T>, IEnumerable, ICloneable, INotifyCollectionChanged where T : ISelectable, IComparable
Type Parameters
Name | Description |
---|---|
T | The type of the objects in the collection. |
Remarks
The collection only supports INotifyCollectionChanged.Add, INotifyCollectionChanged.Remove and INotifyCollectionChanged.Reset actions. Internally, the enumerated objects are maintained as a sorted list to facilitate lookups to determine whether an object is contained in the list. The Contains method does a binary search to quickly determine if an object is in this list.
Constructors
GridSelectedObjectsBase(ISupportsRecordSelection<T>)
Declaration
public GridSelectedObjectsBase(ISupportsRecordSelection<T> owner)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Windows.Controls.Grid.ISupportsRecordSelection<T> | owner |
Properties
Count
Gets the number of objects in this collection.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
Item[Int32]
Returns the object at the given collection position.
Declaration
public T this[int i] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The position. |
Property Value
Type | Description |
---|---|
T | The object. |
LockGridRefresh
Gets or sets whether GridControl.InvalidateCells() is automatically called when the collection is modified.
Declaration
public bool LockGridRefresh { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
If you set this value to true and then do actions that change the contents of teh collection, then parent GridControlBase display is not automatically refreshed. It would be your responsibilty to call GridControl.InvalidateCells() to ensure the display properly reflects the content of the selected objects collection.
Methods
Add(T)
Adds an object to the collection.
Declaration
public void Add(T n)
Parameters
Type | Name | Description |
---|---|---|
T | n | The object to be added. |
Remarks
This method properly sets the ISelectable.IsSelected value on the object.
Clear()
Clears the collection.
Declaration
public void Clear()
Remarks
This method properly sets the ISelectable.IsSelected value on the object.
Clone()
Returns a clone of this collection.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A new collection holding the same objects. |
Contains(T)
Returns whether or not the passed in object is in this collection.
Declaration
public bool Contains(T n)
Parameters
Type | Name | Description |
---|---|---|
T | n | The object to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the object is in this collection, false otherwise. |
Remarks
This method does not check the value of the ISelectable.IsSelected property on the passed in object. It only considers whether or not the object is in the collection.
OnCollectionChanged(NotifyCollectionChangedAction)
Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.NotifyCollectionChangedAction | action |
OnCollectionChanged(NotifyCollectionChangedAction, T)
Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action, T item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.NotifyCollectionChangedAction | action | |
T | item |
OnCollectionChanged(NotifyCollectionChangedAction, HashSet<T>)
Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action, HashSet<T> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.NotifyCollectionChangedAction | action | |
System.Collections.Generic.HashSet<T> | item |
OnSelectedObjectChanging(T, NotifyCollectionChangedAction)
This method is called just prior to an object being added to or removed from the collection.
Declaration
protected virtual bool OnSelectedObjectChanging(T item, NotifyCollectionChangedAction action)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object being added or removed. |
System.Collections.Specialized.NotifyCollectionChangedAction | action | The action being taken, must be Add, Remove, or Reset. |
Returns
Type | Description |
---|---|
System.Boolean | True if the action should be done to the object, false otherwise. |
Remarks
Override this clase to raise events which can cancel the associated action.
OnSelectedObjectsClearing()
This method is called just prior to the collection being cleared.
Declaration
protected virtual bool OnSelectedObjectsClearing()
Returns
Type | Description |
---|---|
System.Boolean | True if the collection should be cleared, false otherwise. |
Remove(T)
Removes an object from the collections.
Declaration
public void Remove(T n)
Parameters
Type | Name | Description |
---|---|---|
T | n | The object to be removed. |
Remarks
This method properly sets the ISelectable.IsSelected value on the object.
SetSelected(T, Boolean)
Sets the ISelectable.IsSelected value on the object to isSelected, and also calls the Add or Remove method to properly include or exclude the object in this collection
Declaration
public void SetSelected(T n, bool isSelected)
Parameters
Type | Name | Description |
---|---|---|
T | n | The object. |
System.Boolean | isSelected | Whether the object is being selected or unselected. |
Events
CollectionChanged
Event raised after an object has been added or removed from the collection, or after the collection has been reset.
Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
Type |
---|
System.Collections.Specialized.NotifyCollectionChangedEventHandler |