Programmatically selecting row/item

4 posts, 0 answers
  1. Muhammad
    Muhammad avatar
    7 posts
    Member since:
    May 2014

    Posted 18 Dec 2015 Link to this post

    How can I select a specific row programmatically... for example if my list have 10 items and on binding I want to select the 5th one.
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1221 posts

    Posted 22 Dec 2015 Link to this post

    Hi Muhammad,

    With the currently released version of the RadListView there is no way to select items through code. The good new is that the requested feature is included in our source code. This means it will be available in our next official release. It will be available for download by the end of January 2016. 

    Please stay tuned for the release and give it a try once it is out.

    Regards,
    Pavel R. Pavlov
    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. Brent
    Brent avatar
    3 posts
    Member since:
    Jun 2011

    Posted 16 May Link to this post

    How is this done programmatically in code?
  4. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    392 posts

    Posted 18 May Link to this post

    Hello Brent,

    As advised in the ticket you have raised, you can work with the SelectedItems collection of the RadListView and add a specific item from the ItemsSource collection of the control. For Example:

    List<MyItem> items = new List<MyItem>();
    for (int i = 0; i < 5; i++)
    {
        items.Add(new MyItem() { Name = string.Format("Name {0}", i), ID = i });
    }
    this.listView.ItemsSource = items;
    this.listView.SelectedItems.Add((this.listView.ItemsSource as List<MyItem>)[1]);


    Regards,
    Stefan Nenchev
    Telerik by Progress
    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