Posted 18 November 2019, 8:10 pm EST
In my Datagrid I want to select first row default when the data is loaded into the datagrid. Is there any way to select ?
Forums Home / ComponentOne / WPF Edition
Posted by: jagdeeshk on 18 November 2019, 8:10 pm EST
Posted 18 November 2019, 8:10 pm EST
In my Datagrid I want to select first row default when the data is loaded into the datagrid. Is there any way to select ?
Posted 19 November 2019, 5:38 pm EST
Hi,
You can simply set the C1DataGrid.SelectedIndex once the data grid is having data as follows:
dataGrid.SelectedIndex = 0;
Alternatively, you can bind the SelectedItem to the desired index item as follows:
<c1:C1DataGrid x:Name="dataGrid" ItemsSource="{Binding Products}" SelectedItem="{Binding Products[0]}"/>
Thanks,
Basant