Binding to Search Text

11 posts, 1 answers
  1. gordon
    gordon avatar
    27 posts
    Member since:
    Oct 2015

    Posted 28 Feb Link to this post

    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.
  2. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1033 posts

    Posted 05 Mar Link to this post

    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.
  3. gordon
    gordon avatar
    27 posts
    Member since:
    Oct 2015

    Posted 06 Mar in reply to Dilyan Traykov Link to this post

    Hello Dilyan,

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

    <RadMultiColumnComboBox AutoCompleteProvider="{Binding MySuggestProvider}"

    Thanks.

  4. Hans
    Hans avatar
    54 posts
    Member since:
    Nov 2017

    Posted 25 Oct in reply to gordon Link to this post

    Hi Dilyan,

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

    Regards
    Hans

  5. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1033 posts

    Posted 25 Oct Link to this post

    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.
  6. Hans
    Hans avatar
    54 posts
    Member since:
    Nov 2017

    Posted 28 Oct in reply to Dilyan Traykov Link to this post

    Hi Dilyan,

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

    Regards
    Hans

  7. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1033 posts

    Posted 28 Oct Link to this post

    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.
  8. Hans
    Hans avatar
    54 posts
    Member since:
    Nov 2017

    Posted 29 Oct in reply to Dilyan Traykov Link to this post

    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

  9. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1033 posts

    Posted 31 Oct Link to this post

    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.
  10. Hans
    Hans avatar
    54 posts
    Member since:
    Nov 2017

    Posted 06 Nov in reply to Dilyan Traykov Link to this post

    Hi Dilyan,

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

    Kind Regards,
    Hans

     
  11. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1033 posts

    Posted 06 Nov Link to this post

    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.
Back to Top