RepositoryItemLookUpEdit.AutoSuggestComplete Event
Fires after the AutoSuggest event is finished. Allows you to additionally customize the editor.
Namespace: DevExpress.XtraEditors.Repository
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
[DXCategory("Events")]
public event LookUpEditAutoSuggestCompleteEventHandler AutoSuggestComplete
Event Data
The AutoSuggestComplete event's data class is DevExpress.XtraEditors.Controls.LookUpEditAutoSuggestCompleteEventArgs.
Remarks
The AutoSuggestComplete event fires if the RepositoryItemLookUpEditBase.TextEditStyle property is set to Standard.
The code below focuses a suggestion in a drop-down list if this is the only suggestion found. As a result, a user can press Tab or Enter to select this suggestion, without having to press the Down arrow first.
private void AutoSuggestCompleteHandler(object sender, LookUpEditAutoSuggestCompleteEventArgs e) {
var edit = (LookUpEdit)sender;
if (e.QuerySuggestions.Result.Count == 1) {
var popup = edit.GetPopupEditForm();
popup.SelectedIndex = 1;
}
}
The following sample dynamically changes the drop-down panel height, depending on how many suggestions it shows.
void LookUpEdit1_AutoSuggestComplete(object sender, DevExpress.XtraEditors.Controls.LookUpEditAutoSuggestCompleteEventArgs e) {
var form = ((LookUpEdit)sender).GetPopupEditForm();
int recordCount = e.QuerySuggestions.Result.Count;
if(recordCount < 10) {
form.Size = new System.Drawing.Size(form.Width, recordCount*25);
}
}