New to Telerik UI for WinForms? Start a free 30-day trial

Manages the bound or unbound data source, current item/position and value formatting for a RadListElement.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class ListDataLayer : IDataItemSource, IDisposable

Inheritance: objectListDataLayer

Implements: IDataItemSourceIDisposable

Constructors

Initializes the data layer, its source and item collection, and subscriptions to the data view's current-item events.

C#
public ListDataLayer(RadListElement owner)
Parameters:ownerRadListElement

The list element that consumes this data layer.

Properties

Gets or sets the binding context used to resolve the bound data source's currency manager.

C#
public BindingContext BindingContext { get; }

Implements: IDataItemSource.BindingContext

Gets or sets whether adding a new item automatically makes it the current item.

C#
public bool ChangeCurrentOnAdd { get; set; }

Gets or sets the name of the boolean data source field bound to each item's checked state.

C#
public string CheckedMember { get; set; }

Gets or sets the item that is the current position in the underlying data view.

C#
public RadListDataItem CurrentItem { get; set; }

Gets or sets the index of the current item within the data view; -1 when no item is current.

C#
public int CurrentPosition { get; set; }

Gets or sets the name of the list or table within DataSource to bind to, when the data source contains multiple lists.

C#
public string DataMember { get; set; }

Gets or sets the object providing data for the list; setting it discards any cached value converter.

C#
public object DataSource { get; set; }

Gets the collection view that applies sorting, filtering and grouping to the list's items.

C#
public RadCollectionView<RadListDataItem> DataView { get; }

Gets or sets the name of the data source field used for an item's supplementary description text.

C#
public string DescriptionTextMember { get; set; }

Gets or sets the name of the data source field whose value is displayed for each item; changing it refreshes cached item text.

C#
public string DisplayMember { get; set; }

Gets the collection of items currently displayed by the list.

C#
public RadListDataItemCollection Items { get; }

Gets the underlying source that bridges the bound data source and the collection of RadListDataItem objects.

C#
public RadListSource<RadListDataItem> ListSource { get; }

Gets the list element that owns this data layer.

C#
public RadListElement Owner { get; }

Gets or sets the name of the data source field that supplies each item's underlying value (as opposed to its displayed text).

C#
public string ValueMember { get; set; }

Methods

Forwards the data view's current-item change as a CurrentPositionChanged notification.

C#
protected virtual void CollectionView_CurrentChanged(object sender, EventArgs e)
Parameters:senderobject

The data view that raised the event.

eEventArgs

The event data.

Raises the cancelable current-position notification and transfers its cancellation result to the data view.

C#
protected virtual void CollectionView_CurrentChanging(object sender, CancelEventArgs e)
Parameters:senderobject

The data view that raised the event.

eCancelEventArgs

The event data whose Cancel value is updated.

Creates the item collection associated with this data layer and its owning list element.

C#
protected virtual RadListDataItemCollection CreateItemsCollection(RadListElement owner)
Parameters:ownerRadListElement

The list element that owns the collection.

Returns:

RadListDataItemCollection

The collection backed by this data layer.

Creates the list source that adapts bound records to RadListDataItem instances.

C#
protected virtual ListControlListSource CreateListSource()
Returns:

ListControlListSource

The source associated with this data layer.

Unwires internal event handlers and disposes the underlying list source.

C#
public void Dispose()

Implements: IDisposable.Dispose()

Gets the formatted description value for a bound item, using DescriptionTextMember when configured.

C#
public object GetDescriptionTextValue(RadListDataItem item)
Parameters:itemRadListDataItem

The list item whose bound record supplies the description.

Returns:

object

The converted description value; a null field value is returned as an empty string.

If the configured member path is invalid, this method falls back to the bound record and clears the display, value, and description member settings.

Gets the raw display-member value for the specified item from the bound data source, or the item's own value when unbound.

C#
public object GetDisplayValue(RadListDataItem item)
Parameters:itemRadListDataItemReturns:

object

Gets the item located at the specified position in the data view.

C#
public RadListDataItem GetItemAtIndex(int index)
Parameters:indexintReturns:

RadListDataItem

Gets the items between the specified positions, inclusive of both bounds.

C#
public List<RadListDataItem> GetItemRange(int startIndex, int endIndex)
Parameters:startIndexintendIndexintReturns:

List<RadListDataItem>

Gets the position of the specified item's underlying row within the data view.

C#
public int GetRowIndex(RadListDataItem item)
Parameters:itemRadListDataItemReturns:

int

Converts the item's display value to its string representation using the cached string converter.

C#
public string GetUnformattedValue(RadListDataItem item)
Parameters:itemRadListDataItemReturns:

string

Gets the value-member value for the specified item, used as the item's underlying value distinct from its display text.

C#
public object GetValue(RadListDataItem item)
Parameters:itemRadListDataItemReturns:

object

Gets the number of items currently passing the active filter.

C#
public int GetVisibleItemsCount()
Returns:

int

Performs one-time setup of the data layer after construction; raises Initialized.

C#
public void Initialize()

Implements: IDataItemSource.Initialize()

Creates a new, unattached data item compatible with this list's item type.

C#
public IDataItem NewItem()
Returns:

IDataItem

Implements: IDataItemSource.NewItem()

Raises CurrentPositionChanged with the new current index.

C#
protected virtual void OnCurrentPositionChanged(int newPosition)
Parameters:newPositionint

The index of the current item.

Raises CurrentPositionChanging and reports whether the position change was canceled.

C#
protected virtual bool OnCurrentPositionChanging(int newPosition)
Parameters:newPositionint

The supplied position; the data view's current-changing event does not expose its target index, so the callback passes -1.

Returns:

bool

true if an event handler cancels the change; otherwise, false.

Forces the underlying data view to re-evaluate sorting, filtering and grouping.

C#
public void Refresh()

Removes the subscriptions established by WireEvents().

C#
protected virtual void UnwireEvents()

Subscribes to the underlying data view's current-item changing and changed events.

C#
protected virtual void WireEvents()

Events

Occurs after BindingContext has changed.

C#
public event EventHandler BindingContextChanged

Implements: IDataItemSource.BindingContextChanged

Occurs after CurrentPosition has changed.

C#
public event PositionChangedEventHandler CurrentPositionChanged

Occurs before CurrentPosition changes, allowing the change to be canceled.

C#
public event PositionChangingEventHandler CurrentPositionChanging

Occurs after the data layer has completed initialization.

C#
public event EventHandler Initialized