When use PagedCollectionView to feed data for DataGrid, I have set CurrentItem for PageCollectionView. When data is bound to xamGrid, it should select the this item automatically.
However it doesn't happen. How to write the code to select the row automatically?
Hi,
To see how set selection programmatically you check this article - http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=SL_xamGrid_Setting_Selection_Programmatically.html.
If you want to select a row when the active cell is changed you can use the ActiveCellChanged event and the ActiveCell property (You can use the Row property of the ActiveCell to get a reference to the row).
Regards,
Two questions for your suggestion:
1. ActiveCellChanged is actually a reponse to CellChanged event. But what I want to is how to select the row/cell in code. this is something before ActiveCellChanged and want to trigger the event.
2. this.Grid.Rows[0].IsSelected = true;
Above code did trigger row selected event but is only available when data already loaded. When I use ria service to loaded, I don't know when the loading completed as async call on service. So above code can't be put in user control code behind. For my situation, data loaded in viewmode so loadedCompleted event is not available in code behind for user control.
I also have this kind of problem. I would like to re-select the rows which was selected before the grid items list is updated. But it seems there is some time difference between data loaded and showing in the browser. If I trigger the function which is setting the selection after data loaded, the view is updated after this setting, then the selection is cleaned again. At the setting moment, the dataSource is already updated, but the Grid.Rows are still old.
Is there any event to know the grid is updated after the data is loaded?