AutoCompleteView

7 posts, 1 answers
  1. Klejda
    Klejda avatar
    5 posts
    Member since:
    Jul 2018

    Posted 18 Feb Link to this post

    Hello , 

    I want to add  every row that i select from the AutoCompleteView into a grid that will be located in the same page as the AutoCompleteView .

    My question is how can i get the selected element and add it to the grid ? 

  2. Didi
    Admin
    Didi avatar
    249 posts

    Posted 18 Feb Link to this post

    Hi Klejda,

    I have created a sample that shows how to achieve the described scenario. The solution works in both scenarios: DisplayMode="Plain" or the DisplayMode="Tokens".

    Please take a look at the attached project and let me know if you have any additional questions on this.

    Regards,
    Didi
    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. Klejda
    Klejda avatar
    5 posts
    Member since:
    Jul 2018

    Posted 19 Feb in reply to Didi Link to this post

    The problem is that we are using Xamarin Forms and i need to have my events in the ViewModel and nothing in the back code . 

    So I want to get the SelectedItem in my ViewModel where i can create and fire my event . I saw your example but it is not what i am looking for .

     

  4. Didi
    Admin
    Didi avatar
    249 posts

    Posted 19 Feb Link to this post

    Hello Klejda,

    Currently, the RadAutoCompleteView does not provide a command equivalent to the SuggestionItemSelected event. In this case you will need to use a Xamarin.Forms EventToCommandBehavior. 

    You'll get the event args as a command parameter and add the selected item to the RadDataGrid ItemsSource.
     
    For example:

    <telerikInput:RadAutoCompleteView.Behaviors>
        <local:EventToCommandBehavior EventName="SuggestionItemSelected"
                            Command="{Binding SuggestionSelectedCommand}"/>
    </telerikInput:RadAutoCompleteView.Behaviors>

    public Command SuggestionSelectedCommand { get; set; }

    private void OnSuggestedSelected(object obj)
    {
        if (obj is SuggestionItemSelectedEventArgs e)
        {
            var item = e.DataItem;
            this.SelectedItems.Add((Person)item);
        }
    }

    Please take a look at the attached project how this could be achieved and let me know if you have any additional questions or concerns.

    Regards,
    Didi
    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. Klejda
    Klejda avatar
    5 posts
    Member since:
    Jul 2018

    Posted 19 Feb Link to this post

    It worked perfectly , exactly what i was looking for . 

    No , at the moment that i want to remove a selected item , i want to remove it from the grid too . 

    Is there any way to do this ?

  6. Klejda
    Klejda avatar
    5 posts
    Member since:
    Jul 2018

    Posted 19 Feb in reply to Klejda Link to this post

    Now*
  7. Answer
    Didi
    Admin
    Didi avatar
    249 posts

    Posted 19 Feb Link to this post

    Hi Klejda,

    I have modified the attached project regarding how to Add and Remove items to the RadDataGrid using the Tokens Collection of the AutoCompleteView control. Please take a look at the MyConverter.cs and MainPage.xaml files how this could be achieved. 

    I hope this could help.

    Regards,
    Didi
    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