Skip to main content

LookUpEdit.ItemIndex Property

Gets or sets the index of the selected row in the dropdown.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v25.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[Browsable(false)]
public virtual int ItemIndex { get; set; }

Property Value

Type Description
Int32

The zero-based index of the selected row in the editor’s dropdown. -1 if no row is currently selected, or the data source is not specified.

Remarks

Use the ItemIndex property to select a data item (row) by its visual position in the dropdown.

When initializing the form, call the LookUpEdit.Properties.ForceInitialize method before setting the ItemIndex property. The ForceInitialize method forces the lookup to initialize.

public Form1() {
    InitializeComponent();
    // Bind the lookupEdit1 control to a data source.
    lookUpEdit1.Properties.DataSource = DataHelper.Load();
    // Forces lookup to initialize.
    lookUpEdit1.Properties.ForceInitialize();
    // Set the selected item to the second item in the list.
    lookUpEdit1.ItemIndex = 1;
}
See Also