Search code examples
c#.netinitializationdevexpressxtragrid

DevExpress WinForms Grid Initialization best practices


I am using a DevExpress DataGrid control, and what I basically do on form initialization is: populate with data, set grouping, disabling some options via

gridView1.OptionsCustomization
gridView1.OptionsView

and doing things like:

gridView1.ExpandAllGroups();

Not the question: what to use to minimize the impact on first showing the XtraGrid? Data is not really big, maybe 20-30 rows at a time, not more. If looking for methods like SuspendLayout / ResumeLayout and such.

I know that there are methods like BeginUpdate and EndUpdate, but the invalidate the whole control, right? This is why I'm asking for "best practices". What are my options?


Solution

  • Such code should be implemented within the gridView's BeginUpdate / EndUpdate brackets. For more information, please refer to the Batch Modifications Overview topic.