By design the RadAutoCompleteBox control is designed to support validation but not out of the box because there isn't a one validation fits all approach that could be built-in in the control. The control is designed to support any of the well known object validation approaches used (for example implementing IDataErrorInfo
We are not sure what scenario you are exactly trying to achieve but if you want to have validation for when there is not a selected item and allow a custom entry for selected item you could do the following:
- Implement the IDataErrorInfo interface in your ViewModel
- Create a property for the SelectedItem/SelectedItems depending on the mode in which you are using the control
- Create a bool property that should indicate if a custom entry should be added to the ItemsSource collection and set a SelectedItem
- Bind those properties to the control and add a button (or other implementation) that will add the "custom" selected item
I created a sample project of the described approach for you. Note that this is an example project which purpose is to illustrate a possible solution to the described desired behavior. Hope this is helpful.
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>