This is a migrated thread and some comments may be shown as answers.

Binding to Search Text

10 Answers 89 Views
MultiColumnComboBox
This is a migrated thread and some comments may be shown as answers.
gordon
Top achievements
Rank 1
gordon asked on 28 Feb 2019, 04:41 PM
Is there property I can bind to similar to SearchText in RadAutoCompleteBox?  I want the user to be able to add new item to the collection bound to the gird view.  Thanks.

10 Answers, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 05 Mar 2019, 10:52 AM
Hello gordon,

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.
0
gordon
Top achievements
Rank 1
answered on 06 Mar 2019, 11:31 PM

Hello Dilyan,

I was able to bind to AutoCompleteProvider, and access its SearchText in my DataContext  E.g.

<RadMultiColumnComboBox AutoCompleteProvider="{Binding MySuggestProvider}"

Thanks.

0
Hans
Top achievements
Rank 1
Veteran
answered on 25 Oct 2019, 08:56 AM

Hi Dilyan,

could you please provide some more information ? What is the type of MySuggestProvider ?

Regards
Hans

0
Dilyan Traykov
Telerik team
answered on 25 Oct 2019, 03:17 PM

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

Want 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.
0
Hans
Top achievements
Rank 1
Veteran
answered on 28 Oct 2019, 12:41 PM

Hi Dilyan,

thanks for the reply.  I tried Gordons solution, without luck.  The bound property (MySuggestProvider) is always null. Any ideas why ?

Regards
Hans

0
Dilyan Traykov
Telerik team
answered on 28 Oct 2019, 04:23 PM

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

Want 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.
0
Hans
Top achievements
Rank 1
Veteran
answered on 29 Oct 2019, 10:02 AM

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

0
Dilyan Traykov
Telerik team
answered on 31 Oct 2019, 12:06 PM

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

Want 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.
0
Hans
Top achievements
Rank 1
Veteran
answered on 06 Nov 2019, 01:22 PM

Hi Dilyan,

thanks for the reply and the sample project.  It helped me a lot to solve my problem.

Kind Regards,
Hans

 
0
Dilyan Traykov
Telerik team
answered on 06 Nov 2019, 02:56 PM

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

Want 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.
Tags
MultiColumnComboBox
Asked by
gordon
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
gordon
Top achievements
Rank 1
Hans
Top achievements
Rank 1
Veteran
Share this question
or