10 Answers, 1 is accepted
You can get ahold of the text which has currently been entered via the AutoCompleteProvider.SearchText property:
<
TextBlock
Text
=
"{Binding AutoCompleteProvider.SearchText, ElementName=mccb}"
/>
Please let me know whether using this property will suit your requirements.
Regards,
Dilyan Traykov
Progress TelerikWant to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Hello Dilyan,
I was able to bind to AutoCompleteProvider, and access its SearchText in my DataContext E.g.
<RadMultiColumnComboBox AutoCompleteProvider="{Binding MySuggestProvider}"
Thanks.
Hi Dilyan,
could you please provide some more information ? What is the type of MySuggestProvider ?
Regards
Hans
Hi Hans,
I'm uncertain about Gordon's exact implementation, but the AutoCompleteProvider property is of type Telerik.Windows.Controls.MultiColumnComboBox.SuggestProvider. I assume that MySuggestProvider is the name of the property in the viewmodel which is of the aforementioned type.
Regards,
Dilyan Traykov
Progress Telerik
Hi Dilyan,
thanks for the reply. I tried Gordons solution, without luck. The bound property (MySuggestProvider) is always null. Any ideas why ?
Regards
Hans
Hi Hans,
For the binding to the property in your viewmodel to work, its mode needs to be set to OneWayToSource. I've prepared a small sample project to demonstrate this.
Otherwise, you would need to initialize a new SuggestProvider in your viewmodel which would also require passing in a QueryableCollectionView as a parameter and optionally, a SearchStateManager.
Is there a reason why the approach I suggested in my first reply would not work for you? If you would specify your exact requirement, I'd be more than happy to offer a viable solution for your particular case.
Regards,
Dilyan Traykov
Progress Telerik
Hi Dilyan,
I would like to be able to clear the search text in some specific cases. I'll give you an example:
We have an application where our users can register the customers he meets at a trade fair.
When a user creates a new record , he can type whatever he wants in the MultiColumnComboBox, which is bound to a list of customers. Now, if no matching customer is found, and the user cancels the creation, the typed text remains visible in the MultiColumnComboBox (see attached file) even when the user moves the pointer to another record !
See attached screenshots.
Regards,
Hans
Hi Hans,
Thank you very much for the clarification and provided images.
I've prepared a small sample project to demonstrate a possible approach for clearing the search text via a command. You can invoke this command when the current item changes, possibly by using the EventToCommandBehavior class and handling the SelectionChanged event.
Please let me know if something similar would work in your actual project.
Regards,
Dilyan Traykov
Progress Telerik
Hi Dilyan,
thanks for the reply and the sample project. It helped me a lot to solve my problem.
Kind Regards,
Hans
Hi Hans,
I'm happy to hear you found my reply helpful. If I can further assist you with anything else, please let me know.
Regards,
Dilyan Traykov
Progress Telerik