This is a migrated thread and some comments may be shown as answers.

select first row when gird is loaded

6 Answers 328 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Khurram Ilyas
Top achievements
Rank 1
Khurram Ilyas asked on 24 Mar 2010, 03:52 PM
How to select the first by default when grid is loaded.

6 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 24 Mar 2010, 03:59 PM
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.
0
Khurram Ilyas
Top achievements
Rank 1
answered on 25 Mar 2010, 07:27 AM
Hi Pavel Pavlov 
can we do this in xaml i mean is there any property for this. ?

Thanks,
Saqib Ali
0
Vlad
Telerik team
answered on 25 Mar 2010, 08:05 AM
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.
0
Marc Roussel
Top achievements
Rank 2
answered on 01 May 2013, 12:26 PM
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]; });
}
0
Dimitrina
Telerik team
answered on 01 May 2013, 03:30 PM
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.

0
Marc Roussel
Top achievements
Rank 2
answered on 01 May 2013, 03:50 PM
Thank you :)
Tags
GridView
Asked by
Khurram Ilyas
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Khurram Ilyas
Top achievements
Rank 1
Vlad
Telerik team
Marc Roussel
Top achievements
Rank 2
Dimitrina
Telerik team
Share this question
or