SuggestionsSource

6 posts, 0 answers
  1. Carlos
    Carlos avatar
    4 posts
    Member since:
    Apr 2013

    Posted 27 Aug 2013 Link to this post

    Hi,

    I am trying to change the SuggestionsSource property when the user types a certain text. For that I have set the TextChanged event to identify when the typed text is the one I'm looking for. When that happens, I update the SuggestionsSource property with a new list of strings but the autocomplete box still uses the old object for SuggestionsSource. It is only when I type another char that the source appears updated in the UI.

    The update of the SuggestionsSource property is done within Dispatcher.BeginInvoke.

    Is this approach correct to achieve the change of SuggestionsSource property on runtime?

    Best,
    Carlos.
  2. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 27 Aug 2013 Link to this post

    Hi Carlos,

    Thanks for writing.

    The scenario you are trying to implement is not officially supported. When the TextChanged event is fired the AutoCompleteBox has already processed the input based on the existing source. When you change the source, the subsequent inputs will be processed in its context.

    Could you please share some more details on why would you want to change the source?

    Regards,
    Deyan
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Carlos
    Carlos avatar
    4 posts
    Member since:
    Apr 2013

    Posted 28 Aug 2013 Link to this post

    Hi,

    thanks a lot for the prompt response.

    The App I'm working on has a search feature. The users is shown search suggestions based on what she types. In this scenario we have then two types of suggestions, local suggestions (saved within the App as a text file) and remote suggestions (generated from a server when local suggestions deliver no result). At the moment when local suggestions can't deliver any text, a new set of strings is fetched from a remote server. When this is done so, the SuggestionsSource property has to be change to make use of the new ones.

    Is there any way of achieving this some other way than updating the SuggestionsSource property? 

    Best,
    Carlos.
  5. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 02 Sep 2013 Link to this post

    Hi Carlos,

    Thanks for writing back and for the requested details.

    RadAutoCompleteBox supports updating the SuggestionsSource by simply appending new items to it. If you use an ObservableCollection as a suggestion source, you will be able to add new suggestions in the source collection and filter against them when the users provide new input.

    Can you please try using this approach and let me know if it works for you?

    Regards,
    Deyan
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  6. Carlos
    Carlos avatar
    4 posts
    Member since:
    Apr 2013

    Posted 02 Sep 2013 Link to this post

    Hi Deyan,

    thanks for your answer.

    Your suggestion has solved the problem but now I have another one. I use Clear on the ObservableCollection to remove all strings. That method seems to be confusing the RadAutocompleteBox because then suggestions stop to appear on the screen although new ones were loaded.

    Is there any known issue with ObservableCollection and Clear method when updating the SuggestionsSource property?

    Best,
    Carlos.
  7. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 03 Sep 2013 Link to this post

    Hi Carlos,

    Thanks for writing back.

    There might be a small bug which causes this behavior and we are willing to take a look at it. Could you please share your project which we can use to debug the scenario and see how we can address the glitch?

    You will have to open a new support ticket in order to be able to do that.

    Regards,
    Deyan
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top
DevCraft banner