Back to Devexpress

RepositoryItemCollection.Add(String) Method

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemcollection-dot-add-x28-system-dot-string-x29.md

latest5.9 KB
Original Source

RepositoryItemCollection.Add(String) Method

Creates a new repository item of the specified type and adds it to the end of the collection.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual RepositoryItem Add(
    string editorName
)
vb
Public Overridable Function Add(
    editorName As String
) As RepositoryItem

Parameters

NameTypeDescription
editorNameString

A string value specifying the repository item type by the corresponding editor type name.

|

Returns

TypeDescription
RepositoryItem

A RepositoryItem descendant representing the new repository item.

|

Remarks

If the editor type name is specified incorrectly, an exception is raised.

To add a number of repository items at once, use the RepositoryItemCollection.AddRange method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-bars-create-baredititem/CS/Form1.cs#L138

csharp
// create combo
combo = barManager1.RepositoryItems.Add("ComboBoxEdit") as DevExpress.XtraEditors.Repository.RepositoryItemComboBox;
combo.Items.Add("Item A");

winforms-grid-multiple-row-selection-web-style-checkboxes/CS/E1271/CheckMarkSelection.cs#L114

csharp
try {
    edit = view.GridControl.RepositoryItems.Add("CheckEdit") as RepositoryItemCheckEdit;

winforms-lookup-display-custom-text-for-not-found-edit-value/CS/Form1.cs#L31

csharp
RepositoryItemLookUpEdit editor = gridControl1.RepositoryItems.Add("LookUpEdit") as RepositoryItemLookUpEdit;
editor.DataSource = tblLookUp;

winforms-grid-display-icons-in-data-cells/VB/Form1.vb#L158

vb
AddHandler gridView1.CustomUnboundColumnData, AddressOf GridView1_CustomUnboundColumnData
Dim checkEdit As RepositoryItemCheckEdit = TryCast(gridControl1.RepositoryItems.Add("CheckEdit"), RepositoryItemCheckEdit)
checkEdit.PictureChecked = GetImageFromResource("Image0")

winforms-bars-create-baredititem/VB/Form1.vb#L133

vb
' create combo
combo = TryCast(barManager1.RepositoryItems.Add("ComboBoxEdit"), DevExpress.XtraEditors.Repository.RepositoryItemComboBox)
combo.Items.Add("Item A")

winforms-grid-visualize-master-detail-data/VB/Form1.vb#L44

vb
'Present data in the Picture column as Images
Dim riPictureEdit As RepositoryItemPictureEdit = TryCast(gridControl1.RepositoryItems.Add("PictureEdit"), RepositoryItemPictureEdit)
gridView1.Columns("Picture").ColumnEdit = riPictureEdit

winforms-grid-multiple-row-selection-web-style-checkboxes/VB/E1271/CheckMarkSelection.vb#L144

vb
Try
    edit = TryCast(view.GridControl.RepositoryItems.Add("CheckEdit"), RepositoryItemCheckEdit)
    column = view.Columns.Add()

winforms-lookup-display-custom-text-for-not-found-edit-value/VB/Form1.vb#L32

vb
gridControl1.DataSource = tblGrid
Dim editor As RepositoryItemLookUpEdit = TryCast(gridControl1.RepositoryItems.Add("LookUpEdit"), RepositoryItemLookUpEdit)
editor.DataSource = tblLookUp

See Also

AddRange(RepositoryItem[])

RepositoryItemCollection Class

RepositoryItemCollection Members

DevExpress.XtraEditors.Repository Namespace