Hi,
I use RadGridView component, that I want to clean and reuse with different data in code behind (for example by clicking on button).
So what am I doing is calling a clear on all Columns (RadGridView.Columns.Clear()) and then I will start adding new columns for different data.
But the problem is when I use it with GridViewColumnGroup the clearing or adding new Columns takes an long time (seconds or minutes for test example where I have 500 Columns and 50 ColumnGroups).
Even if I add ColumnGroups before adding Columns, it will only slightly improve the situation.
This slow processing occurs only after component has been displayed at least once. If the component was not already loaded (shown) it takes almost no time.
I tried hidding component before this process, or unsetting ItemsSource, but nothing helped.
Thank you for any help.
Edit:
I added image of Callstack, when i call Clear() method on Columns:
Hi, thank you for sending testing application. The main slowdown occurs when I set EnableColumnGroupsVirtualization to "False" and have frozenColumns. Then the clearing adding new columns is very slow.
I had to turn off ColumnGroupsVirtualization because of one bug which occurs when i have fixedColumns which are not visible (IsVisible="False"):

Please, see Annex, where i changed your App.xaml.cs little bit (added 4 rows of code).
Likely solutions:
1. To use ColumnGroupVirtualization, I would have to probably shift unvisible columns after frozen columns.
2. With ColumnGroupVirtualization off, I would have to set FrozenColumnCount to 0, before clearing columns and then set it back. With this one, there is no significant slowdown
Thank you for your help.