select first row when gird is loaded

7 posts, 0 answers
  1. Khurram Ilyas
    Khurram Ilyas avatar
    29 posts
    Member since:
    Feb 2010

    Posted 24 Mar 2010 Link to this post

    How to select the first by default when grid is loaded.
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 24 Mar 2010 Link to this post

    Hi Khurram Ilyas,
    public MainPage()
           {
               InitializeComponent();
               this.RadGridView1.DataLoaded += new EventHandler<EventArgs>(RadGridView1_DataLoaded);
           }
           void RadGridView1_DataLoaded(object sender, EventArgs e)
           {
               this.RadGridView1.SelectedItem = this.RadGridView1.Items[0];
           }


    Greetings,
    Pavel Pavlov
    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. Khurram Ilyas
    Khurram Ilyas avatar
    29 posts
    Member since:
    Feb 2010

    Posted 25 Mar 2010 Link to this post

    Hi Pavel Pavlov 
    can we do this in xaml i mean is there any property for this. ?

    Thanks,
    Saqib Ali
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 25 Mar 2010 Link to this post

    Hello,

    You can bind SelectedItem to your view model:

    <telerikGrid:RadGridView SelectedItem="{Binding YourViewModelSelectedItemProperty, Mode=TwoWay}" ...

    Sincerely yours,
    Vlad
    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.
  6. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 01 May 2013 Link to this post

    The line is grey but not like when I click it which is highlighted.
    I have put this in DataLoaded :

    if (rgvExpenses.Items.Count > 0)
    {
        rgvExpenses.CurrentItem = rgvExpenses.Items[0];
        this.Dispatcher.BeginInvoke(() => { rgvExpenses.SelectedItem = rgvExpenses.Items[0]; });
    }
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 01 May 2013 Link to this post

    Hello,

    With Q2 2012 we have introduced a new Unfocused state for GridViewRow which will be shown when the GridView is out of focus. You can check this help article for a reference. 
     

    All the best,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 01 May 2013 Link to this post

    Thank you :)
Back to Top
DevCraft banner