private void UpdateSuggestions() { var newPlaceHolderValue = Text; var cleanedNewPlaceHolderValue = Regex.Replace((newPlaceHolderValue ?? string.Empty).ToLowerInvariant(), @"\s+", string.Empty); if (!string.IsNullOrEmpty(cleanedNewPlaceHolderValue) && Suggestions != null) { var filteredSuggestions = Suggestions.Cast <object>() .Where(x => Regex.Replace(x.ToString().ToLowerInvariant(), @"\s+", string.Empty).Contains(cleanedNewPlaceHolderValue)) .OrderByDescending(x => Regex.Replace(x.ToString() .ToLowerInvariant(), @"\s+", string.Empty) .StartsWith(cleanedNewPlaceHolderValue)).ToList(); _availableSuggestions.Clear(); if (filteredSuggestions.Count > 0) { foreach (var suggestion in filteredSuggestions) { _availableSuggestions.Add(suggestion); } if (_availableSuggestions.Count == 1 && _availableSuggestions.First() as string == newPlaceHolderValue) { ShowHideListbox(false); } else { ShowHideListbox(true); } } else { ShowHideListbox(false); } } else { if (_availableSuggestions.Count > 0) { _availableSuggestions.Clear(); ShowHideListbox(false); } } }