windowsforms-devexpress-dot-xtraeditors-dot-repository-4a62186f.md
Represents a collection of repository items.
Namespace : DevExpress.XtraEditors.Repository
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[ListBindable(false)]
public class RepositoryItemCollection :
CollectionBase
<ListBindable(False)>
Public Class RepositoryItemCollection
Inherits CollectionBase
The following members return RepositoryItemCollection objects:
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.
The following example uses a PersistentRepository to reuse a single repository item in a Data Grid and a Tree List.
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Repository;
public partial class Form1 : XtraForm {
public Form1() {
InitializeComponent();
// Create a persistent repository
PersistentRepository rep = new PersistentRepository();
//Add a repository item to the persistent repository
RepositoryItemSpinEdit spin = new RepositoryItemSpinEdit();
rep.Items.Add(spin);
//Link the persistent repository to controls
gridControl1.ExternalRepository = rep;
treeList1.ExternalRepository = rep;
// Assign the repository item to columns
gridView1.Columns["Id"].ColumnEdit = spin;
treeList1.Columns["Id"].ColumnEdit = spin;
}
}
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Repository
Public Partial Class Form1
Inherits XtraForm
Public Sub New()
InitializeComponent()
' Create a persistent repository
Dim rep As New PersistentRepository()
' Add a repository item to the persistent repository
Dim spin As New RepositoryItemSpinEdit()
rep.Items.Add(spin)
' Link the persistent repository to controls
gridControl1.ExternalRepository = rep
treeList1.ExternalRepository = rep
' Assign the repository item to columns
gridView1.Columns("Id").ColumnEdit = spin
treeList1.Columns("Id").ColumnEdit = spin
End Sub
End Class
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.
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;
Dim riDateEdit As RepositoryItemDateEdit = 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
Object CollectionBase RepositoryItemCollection
See Also