2

Does anyone know how to drop down the AutoCompleteBox to see all the values without guessing at an entry and starting typing.

I know I could use a ComboBox but on a data entry form where a user needs to enter lots of information it is preferable for the user to pick up the mouse as little as possible and so therefore I wanted to use the AutoCompleteBox. However, in smaller lists it is also useful to quickly be reminded of the choices which you could do in a combo with the up/down arrow.

I have seen some examples of combining the two controls' functionality into one and I may go this way but wondered if there is a simpler way.

1
  • How big is your small list? E.g. If you only have a dozen or so options - say months of the year... Then a regular drop down select list is likely more appropriate.
    – scunliffe
    Commented Jan 21, 2011 at 12:55

1 Answer 1

2

When I did this I had an autocomplete box on top of a combobox that were both bound to the same value, with the autocomplete box having a larger right margin so you could see the combobox arrow. Then I created a got focus event that opens the list of results and I set the MinimumPrefixLength to 0 so it would search with nothing typed in.

XAML

<sdk:AutoCompleteBox IsTextCompletionEnabled="True" MinimumPrefixLength="0" GotFocus="AutoComplete_GotFocus" />

Code Behind

private void AutoComplete_GotFocus(object sender, RoutedEventArgs e)
{
     AutoCompleteBox box = (AutoCompleteBox)sender;
     box.IsDropDownOpen = true;           
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.