protected override async void SyncItemsCore() { // Текущий текст из поля ввода string currentInput = Filter;
// Проверяем, нужно ли загружать данные if (string.IsNullOrWhiteSpace(currentInput) || currentInput.Length < 3) { DropDownList.ListElement.Items.Clear(); DropDownList.ClosePopup(); return; }
// Отменяем предыдущий запрос _cts.Cancel(); _cts = new CancellationTokenSource();
try { // Задержка перед началом запроса await Task.Delay(300, _cts.Token);
// Загружаем данные var items = await _fetchDataAsync(currentInput);
// Добавляем элементы в выпадающий список foreach (var item in items) { DropDownList.ListElement.Items.Add(item); }
DropDownList.ListElement.EndUpdate();
if (DropDownList.ListElement.Items.Count > 0) { DropDownList.ShowPopup(); // Показываем список, если есть элементы } else { DropDownList.ClosePopup(); } } catch (TaskCanceledException) { // Запрос был отменён — игнорируем } catch (Exception ex) { Console.WriteLine($"Ошибка загрузки данных: {ex.Message}"); } }
protected override bool DefaultFilter(RadListDataItem item) { if (item is not DescriptionTextListDataItem descriptionItem) return base.DefaultFilter(item);
Thank you for the provided picture. However, referring to a picture it is difficult to guess what is the exact setup of RadLayoutControl that you have.
I need to know the specific types you use for advice on which one to modify. Is it possible to provide a sample project with your RadLayoutControl and its items the way you use them so that I can inspect the setup further and provide further assistance.
You can take a look at the Customizing Appearance article that provides examples how to access different elements and customize them. RadControlSpy tool might be quite useful if you need to inspect the inner elements of our controls and change their appearance.
Please let me know if you need further assistance.
Regards,
Nadya | Tech Support Engineer
Progress Telerik