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.
Mike
I have finished this project in February. I am sorry, but I really do not remember details now. I have done something that made the grid work, and users are now happy. I have extracted this code to show solution as I remember it. I am afraid I cannot recreate the problem now.
Sorry again.
Igor
imariash said: I have tried to call BeginInvoke for scrolling after this function. It didn't help due to the fact that the grid is initialising: I am receiving exception "Invoke or BeginInvoke cannot be called on a control until the window handle has been created"
I have tried to call BeginInvoke for scrolling after this function. It didn't help due to the fact that the grid is initialising: I am receiving exception
"Invoke or BeginInvoke cannot be called on a control until the window handle has been created"
What are you calling BeginInvoke on? The grid? I would think that the grid's Handle would have been created by the time Form_Load fires. If not, you could just as easily using BeginInvoke on the Form instead of on the grid. I know I've used that many times myself.
imariash said:However, I do not believe it is timing. I have seen scrolling working in InitializeGroupByRow (with debugger breakpoint right after the needed row was scrolled). But sometime nearer to the end of Grid update, grid just restores original scroll order (maybe by clearing ActiveRowScrollRegion? or something like this).
I'm not sure I understand what you mean here. You seem to be saying exactly the same thing I said. You are scrolling the row into view using InitializeGroupByRow, but then the grid adjusts the scrolling again afterward - this is what I meant by a timing issue.
Actually... you might even try calling BeginInvoke from inside InitializeGroupByRow, rather than Form_Load. The grid's handle must be created by that point.
If that still doesn't work, can you maybe create a small sample project demonstrating the issue so I can take a look?
Kind of
private void ultraGridBacktest_InitializeGroupByRow(RowsCollection rows, UltraGridRow row)
{
foreach (UltraGridRow row in e.Row.Rows)
this.BeginInvoke(new UpdateFixRowStatusHandle(UpdateFixRowStatus), new object[] {e.Row.Rows, row})
private void UpdateFixRowStatus(RowsCollection rows, UltraGridRow row, bool fixedRow) { try { if (row.VisibleIndex >= 0) { if (fixedRow) { if (!rows.FixedRows.Contains(row)) { row.Fixed = true; } } else { if (rows.FixedRows.Contains(row)) { row.Fixed = false; ultraGrid.DisplayLayout.RowScrollRegions[0].Scroll(RowScrollAction.LineUp); } } //reload order row.RefreshSortPosition(); } } catch(Exception ex) { } }
This code essentially moves the grid one line up in certain conditions that make row visible. But I do not remember details. Above is extract from my code. Hope it helps.
Normal 0 false false false MicrosoftInternetExplorer4
Did you manage to solve this issue as there seems to be several of us who are suffering from the same issue here, although no-one has really helped to resolve this issue,. I'd be keen to know if Infragistics have accepted that this functionality simply doesn’t work.
The whole process doesn’t seem to have been very well thought out, especially when it comes to setting scroll-bar positioning in a group-by situation.
Make
Thank you for advice. DataSource is set at the design time with UltraDataSource. My grid initialisation routine called from Form_Load is simply reading from DB row-by-row and adding rows to UltraDataSource with BeginUpdate() and SuspendRowSynchronization() at the start and ResumeRowSynchronization()/EndUpdate() in finally.
However, I do not believe it is timing. I have seen scrolling working in InitializeGroupByRow (with debugger breakpoint right after the needed row was scrolled). But sometime nearer to the end of Grid update, grid just restores original scroll order (maybe by clearing ActiveRowScrollRegion? or something like this).