I am using MVVM for my WPF application. I have a AutoCompleteBox in my xaml file which works normally. But now, I added a bool flag in my ViewModel isHideDropDown which will hide dropdown for the AutoCompleteBox if set to true. To summarise, I want my AutoCompleteBox to work as normal TextBox if isHideDropDown is set to true.
Can anyone give me some idea?
Thanks
Assuming you’re using the AutoCompleteBox described here.
Setting the
MinimumPrefixLengthto-1will disable the auto complete functionality of the control.So, if you add an
int MinimumPrefixLengthproperty to your ViewModel that returns-1whenisHideDropDownis true, then you can bind to that. The other option would be to write a value converter that converts the booleanisHideDropDownvalue to the appropriate integer.