Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Selecting a grid row programatically does not visually select the row
posted

I am binding a collection to a grid with the ActiveDataItem bound to a property on my ViewModel. When the view first comes up I want the first item selected by default. I'm accomplishing this with the following code in the FieldLayoutInitialized event handler.

 

grid.Records[0].IsActive = true;

grid.Records[0].IsSelected = true;

grid.ActiveRecord = grid.Records[0];

This seems to select the row because my property that is bound to the ActiveDataItem is getting updated. However, the first row in the grid isn't actually highlighted. What am I doing wrong? It also seems odd that I need all three of those lines of code for anything to happen. Just setting the first row IsActive = true doesn't do anything.