Search code examples
c#devexpressdevexpress-windows-ui

Colums.AddRange is to slow


This code takes 15 sec to execute:

this.gridView1.Columns.AddRange(Coloms.ToArray());//the number of Coloms is big

What can I do to speed it up?


Solution

  • Try disabling visual updates.

    this.gridControl1.BeginUpdate();
    this.gridView1.Columns.AddRange(Coloms.ToArray())
    this.gridControl1.EndUpdate();    
    

    Explanation from the documentation:

    After the BeginUpdate method has been called, the currently opened Views are locked, and do not reflect any changes made to their appearance settings. Calling the EndUpdate method unlocks and redraws the Views.