Disable auto first row selection in Grid

4 posts, 1 answers
  1. Anton Swanevelder
    Anton Swanevelder avatar
    28 posts
    Member since:
    Aug 2008

    Posted 08 Jul 2010 Link to this post

    Hi,

    Is there a way to disable the auto selection of the first row of the grid.

    I want nothing to be selected when the user see the grid the first time.

    Thanks in advance
  2. Answer
    Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 08 Jul 2010 Link to this post

    Hi Anton,

     You need to set the IsSynchronizedWithCurrenItem property on the RadGridView to False.

    Best wishes,
    Yavor Georgiev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Daniel Billingsley
    Daniel Billingsley avatar
    95 posts
    Member since:
    Apr 2010

    Posted 12 Jul 2010 Link to this post

    Thanks for this reply.  It solves my immediate problem.

    However, what are the consequences of this for the following scenario?

    If I have a button on each row, and I need to be able to detect the row/item associated with the particular button clicked, I have code like this in the button's click event:

    GridViewRow row = (sender as UIElement).ParentOfType<GridViewRow>();
    row.IsSelected;
    // Is one of these better?
    // myGridView.SelectedItem = row.Item;
    // myGridView.CurrentItem = row.Item;

    I'm currently using the first (IsSelected) option, per sample code provided to solve the scenario described, but I'm thinking that won't work any more with this synchronization turned off.

    I ultimately just need to get the selected or current item (the item associated with the button/row) bound to a property in my ViewModel.  Would either of the last two lines work if I just bind their respective GridView property (SelectedItem vs. CurrentItem)?
  5. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 12 Jul 2010 Link to this post

    Hello Daniel Billingsley,

     Here's a bit more info on IsSynchronizedWithCurrentItem.

    All the best,
    Yavor Georgiev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top