I have xamWebGrid binding to a list and I would like to set focus to first row when application is launched, I have tried different ways, but no luck. Microsoft datagrid has a very simple way to do it. Can someone please help. Thanks
<igGrid:XamWebGrid x:Name="_dgEventsList" AutoGenerateColumns="False" ColumnWidth="*" Height="300" Width="500" ItemsSource="{Binding EventList}"> <igGrid:XamWebGrid.SelectionSettings> <igGrid:SelectionSettings CellClickAction="SelectRow" RowSelection="Single"></igGrid:SelectionSettings> </igGrid:XamWebGrid.SelectionSettings> <igGrid:XamWebGrid.Columns> <igGrid:TextColumn Key="EventName" Width="200" HeaderText="Name"/> <igGrid:TextColumn Key="EventDesc" Width="*" HeaderText="Description"/> <igGrid:TextColumn Key="AppModule" Visibility="Collapsed" HeaderText="AppModule"/> </igGrid:XamWebGrid.Columns> </igGrid:XamWebGrid>
Hi,
In the Grid's Loaded event, you can set the ActiveCell to the first cell in the first row.
grid.ActiveCell = grid.Rows[0].Cells[0];
-SteveZ
Hi SteveZ,
Thanks for the quick answer, This does set focus in the first column of the row, but doesn't select a Row, which causes not to fire "SelectedRowsCollectionChanged" event. Is there any way to get fire automatically or do I need to write a code to handle manually.
Thanks