Hello,Juan Manzanero
Welcome to posting in the Microsoft Community.
I can understand the performance issues you're experiencing with the WPF DataGrid, after all, a smooth scrolling experience is critical for spreadsheet applications, and the need to do so becomes even more of an issue when dealing with large amounts of data. At the same time, I've seen your efforts and can very much empathize with you.
Regarding the code you provided for the WPF DataGrid, there are indeed some optimizations that can be considered to improve performance and fluency, such as the following:
First, make sure you enable virtualization of the data, which can significantly improve the scrolling experience. Virtualization allows only visible rows and columns to be loaded, thus reducing computation and memory consumption.
Second, when dynamically generating columns, you may want to consider using DataGridTemplateColumn. this approach helps you to have more flexibility in controlling cell styling and data binding, avoiding unnecessary rendering stress.
Also, keep an eye on the data binding implementation to make sure that the complexity of the data model doesn't slow down performance. For example, using an ObservableCollection may cause performance issues due to frequent change notifications, especially with large amounts of data. Therefore, simplifying the data structure and reducing the complexity of the initial load is also an effective way to improve responsiveness.
Finally, it is worth noting that the Microsoft community has specialized forums, such as Microsoft Learn, dedicated to this type of developer issues. It is well worth checking out such forums where many technical support and volunteers will discuss and support your specific code implementation. From there you can copy the question and post it directly to the appropriate forum and section (I have selected the correct forum and section for you):
I sincerely hope that after contacting the relevant authorities, your issue will be resolved as soon as possible.
Thank you for your understanding, I really appreciate it!
I wish you all the best!
Best Regards,
Rota|Microsoft Community Support Specialist