Skip to main content

EditorContainer.ExternalRepository Property

Gets or sets the external repository of in-place editors.

Namespace: DevExpress.XtraEditors.Container

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue(null)]
[DXCategory("Data")]
public PersistentRepository ExternalRepository { get; set; }

Property Value

Type Default Description
PersistentRepository null

A PersistentRepository component holding a collection of in-place editors (repository items).

Remarks

Repository items are used to create in-place editors within container controls (GridControl, TreeList, etc.). To use a specific repository item within a container control, the item must be added to the control’s internal repository (see EditorContainer.RepositoryItems) or external repository. Repository items added to a control’s internal repository cannot be used in other controls. To share the same repository item between multiple controls residing on a single form, use an external repository encapsulated by the PersistentRepository component.

You can work with an external repository as follows:

  • Place a PersistentRepository component onto the form;
  • Add repository items to the created repository and customize their settings as required;
  • Assign the repository to the ExternalRepository property of target container controls/components.
  • Associate the control’s elements (columns, cells, etc) to the repository items stored within the specified external repository.

    For instance, use the GridColumn.ColumnEdit property to assign an in-place editor to a grid column. While handling the GridView.CustomRowCellEdit event, use the e.RepositoryItem parameter to dynamically assign an in-place editor to a grid cell.

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;
See Also