Set Selected Items

10 posts, 0 answers
  1. Andrew
    Andrew avatar
    5 posts
    Member since:
    Dec 2012

    Posted 02 Nov 2017 Link to this post

    I have a list of people with their email/name loaded into my autocomplete. Is there a way I can pre-load a selected person object into the autocomplete? I've tried binding the Text property to my view-model, but that doesn't seem to do anything. Any help would be appreciated.
  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    681 posts

    Posted 03 Nov 2017 Link to this post

    Hi Andrew,

    The Autocomplete doesn't operate like a ComboBox, therefore it doesn't have a concept of "SelectedItem" property. That being said, you can set the Text value but there appears to be an issue with DataBinding. I've reported to the development team.

    To workaround this, you'll need to the Text value on the control directly

    protected override void OnAppearing()
    {
        base.OnAppearing();
     
        AutoComplete.Text = "Hello World";
    }


    Note: If you do need a "SelectedItem" type of property you could hook into the control's SuggestionItemSelected event and update a view model property accordingly:

    private void AutoComplete_OnSuggestionItemSelected(object sender, SuggestionItemSelectedEventArgs e)
    {
        (BindingContext as ViewModel).SelectedItem = e.DataItem as BusinessObject;
    }

    Let me know if you have any further questions or concerns.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Umair
    Umair avatar
    4 posts
    Member since:
    Apr 2016

    Posted 05 Nov 2017 Link to this post

    Hi Lance,

     

    I am looking for something similar as well. I tried your approach of assigning text but there are a couple of problems

    1. the SuggestionList appears when I set the text programatically

    2. I can't figure out how to set multiple tokens

    Any help regarding these would be much appreciated. 

  4. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    681 posts

    Posted 06 Nov 2017 Link to this post

    Hello andrew,

    Let me address your comments directly:

    1 - You can programmatically hide the SuggestionView by setting the following:

    ShipperAutoComplete.ShowSuggestionView = false;

    2 - You cannot yet programmatically create Tokens

    You could add Tokens to the tokens collection, but the UI will not be updated. The dev team considered exposing the Token collection as an ObservableCollection but declined it, see this feedback item for the explanation from the dev team.

    However
    , they did approve creating an approach that lets you add Tokens programmatically, see this feedback item to upvote and follow it. At this time, if you need programmatic editing of the AutoComplete's Text, then you'll be restricted to Text mode instead of Tokens mode.

    I hope I was able to answer your questions.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Safak
    Safak avatar
    10 posts
    Member since:
    Mar 2016

    Posted 05 Jan in reply to Lance | Tech Support Engineer, Sr. Link to this post

    Is there any information when will support setting multiple tokens?

     

    Thanks

  6. Yana
    Admin
    Yana avatar
    4682 posts

    Posted 10 Jan Link to this post

    Hello Safak,

    Currently this feature request is not scheduled as the team is working on tasks with higher priority for the upcoming R1 2018 release.

    You could follow the item in order to receive a notification when its status is updated.

    Regards,
    Yana
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Dave
    Dave avatar
    1 posts
    Member since:
    Apr 2013

    Posted 16 Feb in reply to Yana Link to this post

    Without this ability, it effectively makes this control extremely limited.  I often wonder how many real world cases your product team considers.  Otherwise it becomes a control to list for your sales team but in application - us developers suffer to communicate these short comings to our customers.
  8. Yana
    Admin
    Yana avatar
    4682 posts

    Posted 19 Feb Link to this post

    Hi Dave,

    I am sorry to hear about your disappointment with our RadAutoComplete component.  We have identified the control has limited functionality in certain scenarios and we're planning on working on this, however,  this is quite a major task, and I am afraid at this point I cannot commit to any timeframe for this.  I have raised the priority of the feature request and hopefully it will be included in one of the upcoming releases.

    Thank you for sending your feedback.

    Regards,
    Yana
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. John
    John avatar
    1 posts
    Member since:
    Nov 2012

    Posted 19 Feb Link to this post

    I'm evaluating the Telerik UI for Xamarin for a new client project and this issue has kicked the product into touch. No sale I am afraid!
  10. Yana
    Admin
    Yana avatar
    4682 posts

    Posted 20 Feb Link to this post

    Hi John,

    Thank you for sending your comment. I understand this functionality may be vital in certain cases and I am really sorry to hear about your decision not to use Telerik UI for Xamarin.

    I am afraid I cannot add anything else regarding the requested feature to my previous post,  still , I'd like to assure you the team is working hard on improving the suite and the components' feature-set and I hope you will consider it for future projects.

    Regards,
    Yana
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top