We use Wpf Combobox to allow the user to do the following: 1) select the elements by entering the first few characters 2) automatically fill out the record by filtering the list 3) suggesting that the first element matches the letters specified in the selected element
The task is to process the script when the user enters characters that are NOT on the list. This should indicate that the user either made a mistake or wants to introduce a new item.
Combobox is associated with custom types, and they have validation rules related to the fact that the property is filled with the selected one. We cannot figure out how to determine when the user typed the NOT IN THE LIST record and set the bound property to an invalid value that triggers the check.
When the user enters a string of characters that do not represent an item in the list, the selected item becomes zero. Because selecteditem is null, the property path associated with the forms datacontext object cannot be identified by WPF, and therefore the binding is not performed. Then the business object retains all the previous value and does not receive the new value.
user206993
source
share