I would like to set certain Group By row to be visible during grid initialisation. So within InitializeGroupByRow I am checking if row.ValueAsDisplayText is equal to the needed value and then perform scrolling
if ("NeededValue" == e.Row.ValueAsDisplayText){ //expand row.Expanded = true; //scroll ultraGridSubscriptionManager.ActiveRowScrollRegion.ScrollRowIntoView(e.Row); ultraGridSubscriptionManager.ActiveRowScrollRegion.FirstRow = e.Row;
}
However, the last two calls seems to be ignored.
The row is expanded but not scrolled to the first position.
The same happening if I emulate scroll using ActiveRowScrollRegion.Scroll(RowScrollAction.LineDown)
Please advise.
This is probably a timing issue. The grid is probably scrolling based on the positon of the BindingManager, and this occurs after InitializeGroupByRow has fired.
There's really no way to determine when the Initialization is "done" since it's asynchronous. What I would do is... immediately after you set the DataSource and DataMember on the grid (or call SetDataBinding), use BeginInvoke to call a method that scrolls the row you want into view. The BeginInvoke should cause enough delay for the grid to finish up whatever it was doing.
Thank you for suggestion. But I am talking about InitializeGroupByRow not InitializeRow. But the time InitializeGroupByRow is fired everything theoretically should be in place.
However, I will be happy to re-scroll when the grid is totally initialized. Do you know how can I identify that the grid is initialized? I was trying to re-scroll after the UltraDataSource is completly updated (the grid is more or less static from the point of the data), but by this time Grid was not ready: the GroupBy rows have not been created yet.
InitializeRow event fires as each row is initializing. So when you find the "NeededValue" the grid most likely does not yet have all of the data rows so it would be unable to scroll to the desired position. I would recommend setting FirstRow and calling ScrollRowIntoView after the grid is totally initialized. <br><br>
grid.DataSource = myDataSource;<br>
grid.ActiveRowScrollRegion.ScrollRowIntoView(theDesiredRow);<br>
grid.ActiveRowScrollRegion.FirstRow = theDesiredRow;<Br>