AutoComplete for a WPF editable ComboBox including Separator control shows System.Windows.Controls.Separator.
With this xaml:
<ComboBox IsEditable="true">
<ComboBoxItem Content="aaaaa"/>
<ComboBoxItem Content="bbbbb"/>
<ComboBoxItem Content="ccccc"/>
</ComboBox>
Users can started typing with a to c, to auto complete the rest of characters.
a will become aaaaa, b will become bbbbb and so on.
However, the problem is if I want to add separator and make some of them exempting from auto-completion.
I tried this one:
<ComboBox IsEditable="true">
<ComboBoxItem Content="aaaaa"/>
<ComboBoxItem Content="bbbbb"/>
<Separator IsEnabled="false"/>
<ComboBoxItem Content="ccccc" IsEnabled="false"/>
</ComboBox>
When I hit c, combobox still show ccccc as choice.
Also, when I hit S, weirdly the combobox shows System.Windows.Controls.Separator as a choice(!)
My expectation was auto complete only supports typing a and b since the other two (Separator and ccccc) is set to IsEnabled=”false”.
Is there any solution for this?
Please let me know.
Using the items collection to introduce something which looks like a header is probably not such a good idea, you will run into all kinds of problems including this one. You might be better of creating a custom
Templatefor theComboBoxor a custom control altogether which provides properties for this functionality.