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.
Thank you. The recommand code has hardcode for the row selected. like row[0]. But how to use the code to select row dynamically? For example, when xamGrid has paging, first time loading, I want to selecte first row, when moving to next page, the selected row would be first row in that page.
How to process this case?