EzaBlade
EzaBlade

Reputation: 657

Silverlight AutoCompleteBox

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.

Upvotes: 2

Views: 1632

Answers (1)

BurkDiggler
BurkDiggler

Reputation: 161

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;           
}

Upvotes: 2

Related Questions