Back to Devexpress

EditorsRepositoryBase.Items Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-editorsrepositorybase.md

latest3.7 KB
Original Source

EditorsRepositoryBase.Items Property

Provides access to the collection of repository items stored by the repository.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Data")]
public virtual RepositoryItemCollection Items { get; }
vb
<DXCategory("Data")>
Public Overridable ReadOnly Property Items As RepositoryItemCollection

Property Value

TypeDescription
RepositoryItemCollection

A RepositoryItemCollection object

|

Remarks

Use the Items property to access the collection of repository items. The returned object’s members allow you to add, remove and access individual item settings. At design time, the Items property offers an easy to use property editor dialog wherein you can add predefined repository items, remove them and access their properties using the built-in property grid.

Example

The following example uses a PersistentRepository to reuse a single repository item in a Data Grid and a Tree List.

csharp
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;
    }
}
vb
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

See Also

PersistentRepository

RepositoryItemCollection

EditorsRepositoryBase Class

EditorsRepositoryBase Members

DevExpress.XtraEditors.Repository Namespace