Hi,
I have a troubles with switching of field layouts. I want to have a grid where columns can be changed, so I call the method that recreate field layout if set of columns were changed. I have found that it takes about 1-2 seconds to do all this work. It seems to me that Infragistics.Windows.Controls.IGControlBase.ArrangeOverride(Size)
Infragistics.Windows.DataPresenter.GridViewPanelFlat.MeasureOverride(Size)
Infragistics.Windows.DataPresenter.DataPresenterBase.OnLayoutUpdated(Object, EventArgs)
methods are working too long. Could you give me an advise what i am doing in a wrong way?
You can find an example of solution in attached file.
I think this time is expected since there are around 500 visible cell presenters in the grid (10 fields * 50 records). However, when I tested your sample on my machine (Intel Core 2 Duo T9600, 4GB RAM, Window 7 64bit.) I'm getting under/around 1 second for all of the three solutions. If I reduce the number of visible cells in the XamDataGrid, the time reduces as well. You can notice this when you remove the Width, Height in the FieldSettings and the FontSize of the grid or when you decrease the size of the main window.
Could you provide more information about your environment?
Hi Vlad,
I'v tested all 3 solutions: recreate FieldLayout with all fields, recreate only fields in exists FieldLayout, switch between several FieldLatouts. And it seems that all 3 solusions have equivalent slow performance. In attachment you can find sample with all 3 solusions. Time for switching fields in grid for all 3 solution is about ~ 1sec - 1.5 sec. In my real application it about 2sec (I think because i have additional styling for grid). Could you suggest me how can I improve this time?
This issue with the FieldSortDescription.Clear() should be resolved in the next service release currently scheduled for the 26th of July.
Note that recreating the fieldlayouts will generate all of the visible datapresenters elements on the screen at once so one option to improve the time for loading is to set only the first few fields in the view and make the new generated unboundfields to be outside of the visible area. You can see this behavior by decreasing the width and the height of the grid and then changing the layouts.
Another option is to rebind the grid with a new data with the buttons and change the Visibility of the fields accordingly.
Vlad,
Previously we did changes in the current field layout and we had the problem described in this discussion: http://forums.infragistics.com/forums/p/41498/230447.aspx Recreating field layouts can solve this issue.
One better option is to make changes to the current layout instead of generating a new one each time. You can further improve the performance by pregenerating the fields in the Loaded event of the window and then add or remove the them when you switch the layouts. You can also try not to generate a new field if it already exists. Attached is a simple sample that demonstates this approach.
Let me know if you have any questions or concerns.