BetaLyte
BetaLyte

Reputation: 111

AutoComplete in Combobox

I'm pretty new to C#, and I'm working in VS 2010. I'm trying to give a combobox autocomplete-properties. I've googled around alot, and found that the most guides refere to a "AutoComplete" setting, in Properties, but I can't find that setting anywhere. (The "AutoComplete" not "Properties".)

I need to give my autocomplete-function some features: The autocomplete-list needs to be empty to begin with, and when a user enteres something that isn't in the list already, it should be added to the list. So the autocomplete-list only contains strings which is already entered, and adds new entries to the list.

I figure this is some pretty basic code, but it seems I can't google myself to a useful guide.

Upvotes: 4

Views: 1968

Answers (2)

BetaLyte
BetaLyte

Reputation: 111

If found out it is because I'm using WPF and not Windows.Forms. In WPF it is the IsTextSearchEnabled setting that must be set to true. In XAML it would look like this:

<ComboBox Name="comboBox1" Width="170" IsEditable="True" IsTextSearchEnabled="true">
<ComboBoxItem>aaad</ComboBoxItem>
<ComboBoxItem>dddd</ComboBoxItem>
<ComboBoxItem>eeed</ComboBoxItem>
</ComboBox>

Upvotes: 4

Rhapsody
Rhapsody

Reputation: 6077

This is the screen you're looking for:

Visual Studio - Properties

The AutoCompleteCustomSource, AutoCompleteMode and AutoCompleteSource properties are shown as you can see. This Properties Window can be opened with the shortcut F4.

Upvotes: 0

Related Questions