Class RadListSource<TDataItem>
Provides a data binding source that manages strongly-typed data item collections with full support for Windows Forms data binding, list manipulation, and change notifications.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.Data
Assembly: Telerik.WinControls.dll
Syntax
public class RadListSource<TDataItem> : IList<TDataItem>, ICollection<TDataItem>, IEnumerable<TDataItem>, IList, ICollection, IEnumerable, ITypedList, ICancelAddNew, INotifyCollectionChanged, INotifyPropertyChanged, ICurrencyManagerProvider, IDisposable where TDataItem : IDataItem
Type Parameters
|
TDataItem
The type of data items in the list, which must implement IDataItem. |
Remarks
RadListSource serves as a comprehensive data binding intermediary that bridges the gap between various data sources and RadControls. It implements multiple Windows Forms data binding interfaces including System.Collections.IList, System.ComponentModel.ITypedList, System.ComponentModel.ICancelAddNew, and change notification interfaces to provide seamless integration with the .NET data binding infrastructure.
The class manages a collection view that provides advanced data manipulation capabilities such as filtering, sorting, grouping, and paging. It maintains currency management for current item tracking and supports transactional operations for add/edit scenarios.
RadListSource can bind to various data sources including collections, DataTables, business objects, and other data sources through the IDataItemSource interface. It automatically handles data source changes, property descriptor management, and related data source relationships.
Constructors
RadListSource()
Declaration
public RadListSource()
RadListSource(IDataItemSource)
RadListSource(IDataItemSource, RadCollectionView<TDataItem>)
Declaration
public RadListSource(IDataItemSource source, RadCollectionView<TDataItem> collectionView)
Parameters
|
IDataItemSource
source
|
|
RadCollectionView<TDataItem>
collectionView
|
Properties
BoundProperties
Declaration
public PropertyDescriptorCollection BoundProperties { get; }
Property Value
|
System.ComponentModel.PropertyDescriptorCollection
|
CollectionView
Gets the collection view.
Declaration
public RadCollectionView<TDataItem> CollectionView { get; }
Property Value
|
RadCollectionView<TDataItem>
The collection view. |
Count
Declaration
public int Count { get; }
Property Value
|
System.Int32
|
Implements
CreateATransactionForEveryValueSetting
Gets or sets a value indicating whether each value setting should be encapsulaed in its own BeginEdit EndEditTransaction.
Declaration
public bool CreateATransactionForEveryValueSetting { get; set; }
Property Value
|
System.Boolean
|
Current
Gets the current.
Declaration
public TDataItem Current { get; }
Property Value
|
TDataItem
The current. |
DataMember
Gets or sets the name of the list or table in the data source for which the RadListSource<TDataItem> is bound.
Declaration
public string DataMember { get; set; }
Property Value
|
System.String
|
DataSource
Gets or sets the data source of the RadListSource<TDataItem>.
Declaration
public object DataSource { get; set; }
Property Value
|
System.Object
|
IsDataBound
Gets a value indicating whether this instance is data bound.
Declaration
public bool IsDataBound { get; }
Property Value
|
System.Boolean
|
IsReadOnly
Gets a value indicating whether the System.Collections.Generic.ICollection<T> is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
|
System.Boolean
|
Implements
IsUpdating
Determines whether this instance is in a Begin/End update block.
Declaration
public bool IsUpdating { get; }
Property Value
|
System.Boolean
|
Item[Int32]
Gets or sets the item at the specified index.
Declaration
public TDataItem this[int index] { get; set; }
Parameters
|
System.Int32
index
|
Property Value
|
TDataItem
|
Implements
Items
Declaration
protected List<TDataItem> Items { get; set; }
Property Value
|
System.Collections.Generic.List<TDataItem>
|
Position
Gets or sets the position.
Declaration
public int Position { get; set; }
Property Value
|
System.Int32
The position. |
UseCaseSensitiveFieldNames
Declaration
public bool UseCaseSensitiveFieldNames { get; set; }
Property Value
|
System.Boolean
|
Methods
Add(TDataItem)
Adds an item to the System.Collections.Generic.ICollection<T>.
Declaration
public void Add(TDataItem item)
Parameters
|
TDataItem
item
The object to add to the System.Collections.Generic.ICollection<T>. |
Implements
Exceptions
|
System.NotSupportedException
The System.Collections.Generic.ICollection<T> is read-only. |
AddNew()
Adds the new.
Declaration
public virtual TDataItem AddNew()
Returns
|
TDataItem
|
AddNew(TDataItem)
Adds the created item to ListSource.
Declaration
public virtual TDataItem AddNew(TDataItem item)
Parameters
|
TDataItem
item
|
Returns
|
TDataItem
|
AddUnboundInternal(TDataItem)
Used internally by the design time property editor.
Declaration
public void AddUnboundInternal(TDataItem item)
Parameters
|
TDataItem
item
|
BeginUpdate()
Begins the update.
Declaration
public void BeginUpdate()
ChangeItem(Int32, TDataItem, String)
Declaration
protected virtual void ChangeItem(int index, TDataItem item, string propertyName)
Parameters
|
System.Int32
index
|
|
TDataItem
item
|
|
System.String
propertyName
|
Clear()
Removes all items from the System.Collections.Generic.ICollection<T>.
Declaration
public void Clear()
Implements
Exceptions
|
System.NotSupportedException
The System.Collections.Generic.ICollection<T> is read-only. |
ClearItems()
Declaration
protected virtual void ClearItems()
ClearItemsCore()
Declaration
protected virtual void ClearItemsCore()
Contains(TDataItem)
Determines whether the System.Collections.Generic.ICollection<T> contains a specific value.
Declaration
public bool Contains(TDataItem item)
Parameters
|
TDataItem
item
The object to locate in the System.Collections.Generic.ICollection<T>. |
Returns
|
System.Boolean
true if |
Implements
CopyTo(TDataItem[], Int32)
Copies the elements of the System.Collections.Generic.ICollection<T> to an System.Array, starting at a particular System.Array index.
Declaration
public void CopyTo(TDataItem[] array, int arrayIndex)
Parameters
|
TDataItem[]
array
The one-dimensional System.Array that is the destination of the elements copied from System.Collections.Generic.ICollection<T>. The System.Array must have zero-based indexing. |
|
System.Int32
arrayIndex
The zero-based index in |
Implements
Exceptions
|
System.ArgumentNullException
|
|
System.ArgumentOutOfRangeException
|
|
System.ArgumentException
|
CreateDefaultCollectionView()
Declaration
protected virtual RadCollectionView<TDataItem> CreateDefaultCollectionView()
Returns
|
RadCollectionView<TDataItem>
|
Dispose()
Declaration
public void Dispose()
Implements
EndUpdate()
Ends the update.
Declaration
public void EndUpdate()
EndUpdate(Boolean)
Ends the update.
Declaration
public void EndUpdate(bool notifyUpdates)
Parameters
|
System.Boolean
notifyUpdates
if set to |
GetBoundValue(Object, String)
Declaration
public object GetBoundValue(object dataBoundItem, string propertyName)
Parameters
|
System.Object
dataBoundItem
|
|
System.String
propertyName
|
Returns
|
System.Object
|
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<TDataItem> GetEnumerator()
Returns
|
System.Collections.Generic.IEnumerator<TDataItem>
A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection. |
Implements
GetItemProperties(PropertyDescriptor[])
Returns the System.ComponentModel.PropertyDescriptorCollection that represents the properties on each item used to bind data.
Declaration
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
Parameters
|
System.ComponentModel.PropertyDescriptor[]
listAccessors
An array of System.ComponentModel.PropertyDescriptor objects to find in the collection as bindable. This can be null. |
Returns
|
System.ComponentModel.PropertyDescriptorCollection
The System.ComponentModel.PropertyDescriptorCollection that represents the properties on each item used to bind data. |
GetListName(PropertyDescriptor[])
Returns the name of the list.
Declaration
public string GetListName(PropertyDescriptor[] listAccessors)
Parameters
|
System.ComponentModel.PropertyDescriptor[]
listAccessors
An array of System.ComponentModel.PropertyDescriptor objects, for which the list name is returned. This can be null. |
Returns
|
System.String
The name of the list. |
IndexOf(TDataItem)
Determines the index of a specific item in the System.Collections.Generic.IList<T>.
Declaration
public int IndexOf(TDataItem item)
Parameters
|
TDataItem
item
The object to locate in the System.Collections.Generic.IList<T>. |
Returns
|
System.Int32
The index of |
Implements
InitializeBoundRow(TDataItem, Object)
Declaration
protected virtual void InitializeBoundRow(TDataItem item, object dataBoundItem)
Parameters
|
TDataItem
item
|
|
System.Object
dataBoundItem
|
Insert(Int32, TDataItem)
Inserts an item to the System.Collections.Generic.IList<T> at the specified index.
Declaration
public void Insert(int index, TDataItem item)
Parameters
|
System.Int32
index
The zero-based index at which |
|
TDataItem
item
The object to insert into the System.Collections.Generic.IList<T>. |
Implements
Exceptions
|
System.ArgumentOutOfRangeException
|
|
System.NotSupportedException
The System.Collections.Generic.IList<T> is read-only. |
InsertItem(Int32, TDataItem)
Declaration
protected virtual void InsertItem(int index, TDataItem item)
Parameters
|
System.Int32
index
|
|
TDataItem
item
|
Move(Int32, Int32)
Moves the specified item.
Declaration
public void Move(int oldIndex, int newIndex)
Parameters
|
System.Int32
oldIndex
The old index. |
|
System.Int32
newIndex
The new index. |
MoveItem(Int32, Int32)
Declaration
protected virtual void MoveItem(int oldIndex, int newIndex)
Parameters
|
System.Int32
oldIndex
|
|
System.Int32
newIndex
|
NotifyItemChanged(TDataItem)
Raises a CollectionChanged notification with action ItemChanged. Must be paired with the NotifyItemChanging method.
Declaration
public void NotifyItemChanged(TDataItem item)
Parameters
|
TDataItem
item
|
NotifyItemChanged(TDataItem, String)
Raises a CollectionChanged notification with action ItemChanged. Must be paired with the NotifyItemChanging method.
Declaration
public void NotifyItemChanged(TDataItem item, string propertyName)
Parameters
|
TDataItem
item
|
|
System.String
propertyName
|
NotifyItemChanging(TDataItem)
Raises a CollectionChanged notification with action ItemChanging. Must be paired with the NotifyItemChanged method.
Declaration
public void NotifyItemChanging(TDataItem item)
Parameters
|
TDataItem
item
|
NotifyItemChanging(TDataItem, String)
Raises a CollectionChanged notification with action ItemChanging. Must be paired with the NotifyItemChanged method.
Declaration
public void NotifyItemChanging(TDataItem item, string propertyName)
Parameters
|
TDataItem
item
|
|
System.String
propertyName
|
OnCollectionChanged(NotifyCollectionChangedEventArgs)
Declaration
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
|
NotifyCollectionChangedEventArgs
e
|
OnNotifyPropertyChanged(PropertyChangedEventArgs)
Raises the NotifyPropertyChanged event
Declaration
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
Parameters
|
System.ComponentModel.PropertyChangedEventArgs
e
|
OnNotifyPropertyChanged(String)
Raises the PropertyChanged event
Declaration
protected virtual void OnNotifyPropertyChanged(string propertyName)
Parameters
|
System.String
propertyName
The name of the property |
ProcessCurrencyManagerListChanged(Object, ListChangedEventArgs)
Declaration
protected virtual void ProcessCurrencyManagerListChanged(object sender, ListChangedEventArgs e)
Parameters
|
System.Object
sender
|
|
System.ComponentModel.ListChangedEventArgs
e
|
Refresh()
Refreshes this instance.
Declaration
public virtual void Refresh()
Remove(TDataItem)
Removes the first occurrence of a specific object from the System.Collections.Generic.ICollection<T>.
Declaration
public bool Remove(TDataItem item)
Parameters
|
TDataItem
item
The object to remove from the System.Collections.Generic.ICollection<T>. |
Returns
|
System.Boolean
true if |
Implements
Exceptions
|
System.NotSupportedException
The System.Collections.Generic.ICollection<T> is read-only. |
RemoveAt(Int32)
Removes the System.Collections.Generic.IList<T> item at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
|
System.Int32
index
The zero-based index of the item to remove. |
Implements
Exceptions
|
System.ArgumentOutOfRangeException
|
|
System.NotSupportedException
The System.Collections.Generic.IList<T> is read-only. |
RemoveItem(Int32)
Declaration
protected virtual void RemoveItem(int index)
Parameters
|
System.Int32
index
|
Reset()
Resets this instance.
Declaration
public virtual void Reset()
SetBoundValue(IDataItem, String, Object)
Declaration
public bool SetBoundValue(IDataItem dataItem, string propertyName, object value)
Parameters
|
IDataItem
dataItem
|
|
System.String
propertyName
|
|
System.Object
value
|
Returns
|
System.Boolean
|
SetBoundValue(IDataItem, String, Object, String)
Declaration
public bool SetBoundValue(IDataItem dataItem, string propertyName, object value, string path)
Parameters
|
IDataItem
dataItem
|
|
System.String
propertyName
|
|
System.Object
value
|
|
System.String
path
|
Returns
|
System.Boolean
|
SetBoundValue(IDataItem, String, String, Object, String)
Declaration
public bool SetBoundValue(IDataItem dataItem, string propertyName, string columnName, object value, string path)
Parameters
|
IDataItem
dataItem
|
|
System.String
propertyName
|
|
System.String
columnName
|
|
System.Object
value
|
|
System.String
path
|
Returns
|
System.Boolean
|
SetItem(Int32, TDataItem)
Declaration
protected virtual void SetItem(int index, TDataItem item)
Parameters
|
System.Int32
index
|
|
TDataItem
item
|
UnWireEvents()
Declaration
protected virtual void UnWireEvents()
WireEvents()
Declaration
protected virtual void WireEvents()
Events
CollectionChanged
Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
|
NotifyCollectionChangedEventHandler
|
Implements
PositionChanged
Declaration
public event EventHandler PositionChanged
Event Type
|
System.EventHandler
|
PropertyChanged
Occurs when a property value changes.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
|
System.ComponentModel.PropertyChangedEventHandler
|
Explicit Interface Implementations
ICollection.CopyTo(Array, Int32)
Declaration
void ICollection.CopyTo(Array array, int index)
Parameters
|
System.Array
array
|
|
System.Int32
index
|
Implements
ICollection.IsSynchronized
Declaration
bool ICollection.IsSynchronized { get; }
Returns
|
System.Boolean
|
Implements
ICollection.SyncRoot
Declaration
object ICollection.SyncRoot { get; }
Returns
|
System.Object
|
Implements
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
|
System.Collections.IEnumerator
|
Implements
IList.Add(Object)
Declaration
int IList.Add(object value)
Parameters
|
System.Object
value
|
Returns
|
System.Int32
|
Implements
IList.Contains(Object)
Declaration
bool IList.Contains(object value)
Parameters
|
System.Object
value
|
Returns
|
System.Boolean
|
Implements
IList.get_Item(Int32)
Declaration
object IList.get_Item(int index)
Parameters
|
System.Int32
index
|
Returns
|
System.Object
|
Implements
IList.IndexOf(Object)
Declaration
int IList.IndexOf(object value)
Parameters
|
System.Object
value
|
Returns
|
System.Int32
|
Implements
IList.Insert(Int32, Object)
Declaration
void IList.Insert(int index, object value)
Parameters
|
System.Int32
index
|
|
System.Object
value
|
Implements
IList.IsFixedSize
Declaration
bool IList.IsFixedSize { get; }
Returns
|
System.Boolean
|
Implements
IList.Item[Int32]
Declaration
object IList.this[] { get; set; }
Parameters
|
System.Int32
index
|
Returns
|
System.Object
|
Implements
IList.Remove(Object)
Declaration
void IList.Remove(object value)
Parameters
|
System.Object
value
|
Implements
IList.set_Item(Int32, Object)
Declaration
void IList.set_Item(int index, object value)
Parameters
|
System.Int32
index
|
|
System.Object
value
|