New to Telerik UI for WinFormsStart a free 30-day trial

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.

Definition

Namespace:Telerik.WinControls.Data

Assembly:Telerik.WinControls.dll

Type Parameters:

TDataItem

The type of data items in the list, which must implement IDataItem.

Syntax:

C#
public class RadListSource<TDataItem> : IList, ICollection, IEnumerable, ITypedList, ICancelAddNew, INotifyCollectionChanged, INotifyPropertyChanged, ICurrencyManagerProvider, IDisposable where TDataItem : IDataItem

Inheritance: objectRadListSource<TDataItem>

Derived Classes: GridViewListSourceListControlListSourceListViewListSourceTreeMapListSource

Implements: ICancelAddNewICollectionICurrencyManagerProviderIDisposableIEnumerableIListINotifyCollectionChangedINotifyPropertyChangedITypedList...

Constructors

C#
public RadListSource()
C#
public RadListSource(IDataItemSource source, RadCollectionView<TDataItem> collectionView)
Parameters:sourceIDataItemSourcecollectionViewRadCollectionView<TDataItem>
C#
public RadListSource(IDataItemSource source)
Parameters:sourceIDataItemSource

Properties

C#
public PropertyDescriptorCollection BoundProperties { get; }

Gets the collection view.

C#
public RadCollectionView<TDataItem> CollectionView { get; }
Property Value:

The collection view.

C#
public int Count { get; }

Implements: ICollection.Count

Gets or sets a value indicating whether each value setting should be encapsulaed in its own BeginEdit EndEditTransaction.

C#
public bool CreateATransactionForEveryValueSetting { get; set; }

Current

TDataItem

Gets the current.

C#
public TDataItem Current { get; }
Property Value:

The current.

Gets or sets the name of the list or table in the data source for which the RadListSource<TDataItem> is bound.

C#
[Browsable(true)]
public string DataMember { get; set; }

Gets or sets the data source of the RadListSource<TDataItem>.

C#
public object DataSource { get; set; }

Gets a value indicating whether this instance is data bound.

C#
public bool IsDataBound { get; }
Property Value:

true if this instance is data bound; otherwise, false.

Gets a value indicating whether the ICollection<T> is read-only.

C#
public bool IsReadOnly { get; }

Implements: IList.IsReadOnly

Determines whether this instance is in a Begin/End update block.

C#
public bool IsUpdating { get; }

Items

List<TDataItem>

C#
protected List<TDataItem> Items { get; set; }

Gets or sets the position.

C#
public int Position { get; set; }
Property Value:

The position.

this[int]

TDataItem

Gets or sets the item at the specified index.

C#
public TDataItem this[int index] { get; set; }
Parameters:indexint
C#
public bool UseCaseSensitiveFieldNames { get; set; }

Methods

Adds an item to the ICollection<T>.

C#
public void Add(TDataItem item)
Parameters:itemTDataItem

The object to add to the ICollection<T>.

Exceptions:

NotSupportedException

The ICollection<T> is read-only.

Adds the new.

C#
public virtual TDataItem AddNew()
Returns:

TDataItem

Adds the created item to ListSource.

C#
public virtual TDataItem AddNew(TDataItem item)
Parameters:itemTDataItemReturns:

TDataItem

Begins the update.

C#
public void BeginUpdate()
C#
protected virtual void ChangeItem(int index, TDataItem item, string propertyName)
Parameters:indexintitemTDataItempropertyNamestring

Removes all items from the ICollection<T>.

C#
public void Clear()
Exceptions:

NotSupportedException

The ICollection<T> is read-only.

Implements: IList.Clear()

C#
protected virtual void ClearItems()
C#
protected virtual void ClearItemsCore()

Determines whether the ICollection<T> contains a specific value.

C#
public bool Contains(TDataItem item)
Parameters:itemTDataItem

The object to locate in the ICollection<T>.

Returns:

bool

true if item is found in the ICollection<T>; otherwise, false.

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

C#
public void CopyTo(TDataItem[] array, int arrayIndex)
Parameters:arrayTDataItem[]

The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

arrayIndexint

The zero-based index in array at which copying begins.

Exceptions:

ArgumentNullException

array is null.

ArgumentOutOfRangeException

arrayIndex is less than 0.

ArgumentException

array is multidimensional. -or- arrayIndex is equal to or greater than the length of array. -or- The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array. -or- Type T cannot be cast automatically to the type of the destination array.

C#
protected virtual RadCollectionView<TDataItem> CreateDefaultCollectionView()
Returns:

RadCollectionView<TDataItem>

C#
public void Dispose()

Implements: IDisposable.Dispose()

Ends the update.

C#
public void EndUpdate()

Ends the update.

C#
public void EndUpdate(bool notifyUpdates)
Parameters:notifyUpdatesbool

if set to true [notify updates].

C#
public object GetBoundValue(object dataBoundItem, string propertyName)
Parameters:dataBoundItemobjectpropertyNamestringReturns:

object

Returns an enumerator that iterates through the collection.

C#
public IEnumerator<TDataItem> GetEnumerator()
Returns:

IEnumerator<TDataItem>

A IEnumerator<T> that can be used to iterate through the collection.

Returns the PropertyDescriptorCollection that represents the properties on each item used to bind data.

C#
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
Parameters:listAccessorsPropertyDescriptor[]

An array of PropertyDescriptor objects to find in the collection as bindable. This can be null.

Returns:

PropertyDescriptorCollection

The PropertyDescriptorCollection that represents the properties on each item used to bind data.

Implements: ITypedList.GetItemProperties(PropertyDescriptor[])

Returns the name of the list.

C#
public string GetListName(PropertyDescriptor[] listAccessors)
Parameters:listAccessorsPropertyDescriptor[]

An array of PropertyDescriptor objects, for which the list name is returned. This can be null.

Returns:

string

The name of the list.

Implements: ITypedList.GetListName(PropertyDescriptor[])

Determines the index of a specific item in the IList<T>.

C#
public int IndexOf(TDataItem item)
Parameters:itemTDataItem

The object to locate in the IList<T>.

Returns:

int

The index of item if found in the list; otherwise, -1.

C#
protected virtual void InitializeBoundRow(TDataItem item, object dataBoundItem)
Parameters:itemTDataItemdataBoundItemobject

Inserts an item to the IList<T> at the specified index.

C#
public void Insert(int index, TDataItem item)
Parameters:indexint

The zero-based index at which item should be inserted.

itemTDataItem

The object to insert into the IList<T>.

Exceptions:

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The IList<T> is read-only.

C#
protected virtual void InsertItem(int index, TDataItem item)
Parameters:indexintitemTDataItem

Moves the specified item.

C#
public void Move(int oldIndex, int newIndex)
Parameters:oldIndexint

The old index.

newIndexint

The new index.

C#
protected virtual void MoveItem(int oldIndex, int newIndex)
Parameters:oldIndexintnewIndexint

Raises a CollectionChanged notification with action ItemChanged. Must be paired with the NotifyItemChanging method.

C#
public void NotifyItemChanged(TDataItem item, string propertyName)
Parameters:itemTDataItempropertyNamestring

Raises a CollectionChanged notification with action ItemChanged. Must be paired with the NotifyItemChanging method.

C#
public void NotifyItemChanged(TDataItem item)
Parameters:itemTDataItem

Raises a CollectionChanged notification with action ItemChanging. Must be paired with the NotifyItemChanged method.

C#
public void NotifyItemChanging(TDataItem item, string propertyName)
Parameters:itemTDataItempropertyNamestring

Raises a CollectionChanged notification with action ItemChanging. Must be paired with the NotifyItemChanged method.

C#
public void NotifyItemChanging(TDataItem item)
Parameters:itemTDataItem
C#
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters:eNotifyCollectionChangedEventArgs

Raises the NotifyPropertyChanged event

C#
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
Parameters:ePropertyChangedEventArgs

Raises the PropertyChanged event

C#
protected virtual void OnNotifyPropertyChanged(string propertyName)
Parameters:propertyNamestring

The name of the property

C#
protected virtual void ProcessCurrencyManagerListChanged(object sender, ListChangedEventArgs e)
Parameters:senderobjecteListChangedEventArgs

Refreshes this instance.

C#
public virtual void Refresh()

Removes the first occurrence of a specific object from the ICollection<T>.

C#
public bool Remove(TDataItem item)
Parameters:itemTDataItem

The object to remove from the ICollection<T>.

Returns:

bool

true if item was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.

Exceptions:

NotSupportedException

The ICollection<T> is read-only.

Removes the IList<T> item at the specified index.

C#
public void RemoveAt(int index)
Parameters:indexint

The zero-based index of the item to remove.

Exceptions:

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The IList<T> is read-only.

Implements: IList.RemoveAt(int)

C#
protected virtual void RemoveItem(int index)
Parameters:indexint

Resets this instance.

C#
public virtual void Reset()
C#
public bool SetBoundValue(IDataItem dataItem, string propertyName, object value, string path)
Parameters:dataItemIDataItempropertyNamestringvalueobjectpathstringReturns:

bool

C#
public bool SetBoundValue(IDataItem dataItem, string propertyName, object value)
Parameters:dataItemIDataItempropertyNamestringvalueobjectReturns:

bool

C#
public bool SetBoundValue(IDataItem dataItem, string propertyName, string columnName, object value, string path)
Parameters:dataItemIDataItempropertyNamestringcolumnNamestringvalueobjectpathstringReturns:

bool

C#
protected virtual void SetItem(int index, TDataItem item)
Parameters:indexintitemTDataItem
C#
protected virtual void UnWireEvents()
C#
protected virtual void WireEvents()

Events

Occurs when the collection changes.

C#
public event NotifyCollectionChangedEventHandler CollectionChanged

Implements: INotifyCollectionChanged.CollectionChanged

C#
public event EventHandler PositionChanged

Occurs when a property value changes.

C#
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged