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

Stores mail-merge records, their available field names, and the current record position.

Definition

Namespace:Telerik.WinForms.Documents.Model

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class DataItemCollection : INotifyPropertyChanged

Inheritance: objectDataItemCollection

Implements: INotifyPropertyChanged

Constructors

Creates an empty collection with no field metadata and an initial cursor position of -1.

C#
public DataItemCollection()

Properties

Gets the number of records in the collection.

C#
public int Count { get; }

Gets the record at the current cursor position, or null when the position is outside the collection.

C#
public object CurrentItem { get; }

Gets or sets the cursor position. Navigation uses -1 for before the first record and Count for after the last; setting this property directly does not synchronize CurrentItem or raise notifications.

C#
public int CurrentPosition { get; set; }

Gets or sets whether the cursor is positioned after the last record.

C#
public bool IsCurrentAfterLast { get; set; }

Gets or sets whether the cursor is positioned before the first record.

C#
public bool IsCurrentBeforeFirst { get; set; }

Gets the public CLR properties discovered on the source record type.

C#
public ReadOnlyCollection<PropertyInfo> ItemProperties { get; }

Gets the field keys exposed for the source records. Dynamic member names are discovered only when the source records expose no public CLR properties.

C#
public ReadOnlyCollection<string> ItemPropertyKeys { get; }

Methods

Moves to the first occurrence of item in the collection. If the item is not found, the cursor moves before the first record.

C#
public bool MoveCurrentTo(object item)
Parameters:itemobject

The record to select.

Returns:

bool

true if the item is in the collection; otherwise, false.

Moves to the first record.

C#
public bool MoveCurrentToFirst()
Returns:

bool

true if the collection contains a record; otherwise, false.

Moves to the last record.

C#
public bool MoveCurrentToLast()
Returns:

bool

true if the collection contains a record; otherwise, false.

Advances the cursor by one position. Moving past the last record places the cursor after the collection and returns false.

C#
public bool MoveCurrentToNext()
Returns:

bool

true if the cursor points to a record; otherwise, false.

Moves to a record or to one of the boundary positions.

C#
public bool MoveCurrentToPosition(int position)
Parameters:positionint

The zero-based record position, -1 for before the first record, or Count for after the last.

Returns:

bool

true if position identifies a record; otherwise, false.

Exceptions: ArgumentOutOfRangeException

position is less than -1 or greater than Count.

Moves the cursor back by one position. Moving before the first record places the cursor at the before-first position and returns false.

C#
public bool MoveCurrentToPrevious()
Returns:

bool

true if the cursor points to a record; otherwise, false.

Raises the CurrentChanged event.

C#
protected virtual void OnCurrentChanged(EventArgs args)
Parameters:argsEventArgs

The event data passed to handlers.

Raises the PropertyChanged event for the specified property.

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

The name of the property that changed.

Assigns the current record and updates the before-first and after-last flags. This method does not raise change notifications.

C#
protected void SetCurrent(object newItem, int newPosition)
Parameters:newItemobject

The record to make current.

newPositionint

The cursor position to assign. When newItem is null and the collection is empty, both boundary flags are set and the position is forced to -1. Otherwise, a value before zero or at/after Count sets the corresponding boundary flag.

Events

Occurs when navigation changes the current record or cursor position, and when the source records are loaded into the collection.

C#
public event EventHandler CurrentChanged
C#
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged