Skip to main content

RepositoryItemCollection Class

Represents a collection of repository items.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[ListBindable(false)]
public class RepositoryItemCollection :
    CollectionBase

Remarks

The RepositoryItemCollection class maintains a list of items represented by RepositoryItem descendant objects (such as RepositoryItemButtonEdit, RepositoryItemCalcEdit and etc). Each repository item stores settings that can be used to create a fully functional editor

Methods introduced by this class can be used to perform common collection operations such as adding new or deleting existing repository items. Individual repository items can be accessed via the collection’s RepositoryItemCollection.Item property using indexer notation.

RepositoryItemCollection object can be accessed using a container control’s EditorContainer.RepositoryItems or container component’s ComponentEditorContainer.RepositoryItems property. Such collections represent the container controls’/components’ internal repositories. External repository components (PersistentRepository) also maintain collections of repository items available via their PersistentRepository.Items property.

Example

The following example shows how to share a single repository item between two Grid Controls. For this purpose, an external PersistentRepository component must be used.

First, add a specific repository item to the persistent repository and customize it depending upon your needs. Then link the persistent repository to the ExternalRepository properties of the required grid controls. After that, assign the repository item to the required grid columns via the ColumnEdit property.

In this example we create a repository item corresponding to an ImageComboBoxEdit editor.

using DevExpress.XtraEditors.Repository;

//Add a repository item corresponding to a combo box editor to the persistent repository
RepositoryItemComboBox riCombo = new RepositoryItemComboBox();
riCombo.Items.AddRange(new string[] {"Cash", "Visa", "Master", "Am.Express" });
persistentRepository1.Items.Add(riCombo);

//Link the persistent repository to two grid controls
gridControl1.ExternalRepository = persistentRepository1;
gridControl2.ExternalRepository = persistentRepository1;

//Now you can define the repository item as an inplace editor of columns for the two grids
(gridControl1.MainView as GridView).Columns["PaymentType"].ColumnEdit = riCombo;
(gridControl2.MainView as GridView).Columns["PaymentType"].ColumnEdit = riCombo;

Example

The following code shows how to assign a DateEdit in-place editor to a TreeList column in a TreeList control. This example creates the required repository item (RepositoryItemDateEdit), adds it to the control’s internal repository and then binds the repository item to a column.

CD_Repository_Assign_DateEditor_Example

RepositoryItemDateEdit riDateEdit = new RepositoryItemDateEdit();
// Customize the item...
// Add the item to the control's internal repository.
treeList1.RepositoryItems.Add(riDateEdit);
// Bind the item to the control's column.
treeList1.Columns["Start Date"].ColumnEdit = riDateEdit;

Inheritance

Object
CollectionBase
RepositoryItemCollection
See Also