private void OnTextEntered(object sender, string input) { if (string.IsNullOrWhiteSpace(input)) { _listBox.ClearSelection(); return; } var optionIndex = _listBox.Options .Select((opt, idx) => new { Option = opt, Index = idx }) .FirstOrDefault(item => item.Option.StartsWith(input)) ?.Index; if (optionIndex.HasValue) { _listBox.Select(optionIndex.Value); } else { _listBox.ClearSelection(); } }