Hi,
We have recently upgraded from 2006.1 to 2012.2 winforms components.
We have an application that has a grid with card view in a child band. The card view horizontal scroll bar is not linked to the parent grid horizontal scroll bar.
I have attached an image to shows the app with card view on show.
When I double click on a cell in the card view a dialogue box appears. If I close the dialogue box, the card view H scroll bar shoots to the left.
In version 2006.1 the scroll bar stayed where it was at.
As far as I can see, the only code to have changed is:
bodBand.UseRowLayout=true; was changed to bodBand.RowLayoutStyle = RowLayoutStyle.GroupLayout;
and PlanGrid.SupportThemes=false; was changed to PlanGrid.UseOsThemes = DefaultableBoolean.False;
Has there been any changes to settings in the grid?
Thanks
David
Hi David,
Just to clarify - "currency" in this context has nothing to do with money, it refers to "current" as in the current position of the BindingManager.
setting PlanGrid.SyncWithCurrencyManager = false worked perfectly.
So far I have seen no adverse effects. The application does not use Currency Manager. We only work in £ (pounds)
As for your first point, thanks for that as well. Unfortunately we have been given only enough time to do a vanilla upgrade. We're not allowed to apply things like generics or linq etc. But I'll make a note of it so we might be able to apply it in the future, and look for it elsewhere in our applications.
Cheers
I ran your sample and I am seeing the same issue.
When you double click on the card (child) cell, you are looping through every row in the parent table and then looking for every parent row whose first cell is a match for the Name cell in the row you clicked on. I don't think it has anything to do with the problem, but this is very inefficient. You don't need to loop. Your code can be rewritten to do the same thing like so:
void ultraGrid1_DoubleClickCell(object sender, DoubleClickCellEventArgs e) { e.Cell.Value = DBNull.Value; int colIndex = e.Cell.Column.Index; DataRow dataRow = ((DataRowView)e.Cell.Row.ParentRow.ListObject).Row; dataRow[colIndex] = System.DBNull.Value; }
Anyway, that's not the issue. I think what's happening is that changing a value in the parent row of the data source is updating the position of the CurrentlyManager to that row and this, in turn, updates the position of the child currency manager back to 0. So essentially the data source is setting the first child row active and the grid is synchronizing - activating the first card, which then scrolls that card into view.
There are a number of ways you could get around this. The easiest one is to tell the grid not to synchronize it's position with the data source:
this.PlanGrid.SyncWithCurrencyManager = false;
Unless you have other controls on the form that are bound to the same DataSource as the grid, you probably don't need to keep them in synch, anyway.
If that's not acceptable, then I'd recommend changing the parent cell value through the grid instead of going directly to the data source.
void ultraGrid1_DoubleClickCell(object sender, DoubleClickCellEventArgs e) { e.Cell.Value = DBNull.Value; int colIndex = e.Cell.Column.Index; e.Cell.Row.Cells[colIndex].Value = System.DBNull.Value; }
I have been able to replicate it in my test application! My mistake was where I double clicked on the grid. When I double click on the parent row, everything is ok (the scroll bar stays where it belongs). But when I click on the card view cells, the scroll bar goes to the left. (this applies to the real application as well)
I have attached the test application as a zip file. It is a Visual Studio 2010 solution referencing infragistics 2012.2.
To replicate
1. Run the application
2. Expand a row
3. Scroll the card view row to the right
4. Double click on one of the card view cells.
I have attached no initialise row events to the grid and the initialise layout only sets the card view to true.
The problem occurs immediately after the "parent.Rows[i][colIndex] = System.DBNull.Value;" (when I execute an Application.DoEvents() in visual studios immediate window)
I am only using DoEvents during debugging as a way of getting the UI to update while stepping through the code. I think it proves that the scroll bar is affected before specific lines of code are executed.
The only processing I can figure out is happening is the values of a cell (in the parent row. Not the card view row) is being set to DBNull.Value.
I will try stripping down the real version and see what happens.