Improve WPF DataGrid performance

╄→尐↘猪︶ㄣ 提交于 2019-11-27 06:49:30
Alan

There are a few options you can turn on to help you on your DataGrid object

EnableColumnVirtualization = true
EnableRowVirtualization = true

These two are the main ones I think might help. Next try making your binding async

ItemsSource="{Binding MyStuff, IsAsync=True}"

And lastly, I've heard that setting a maximum height and width can help even if it above the max screen size, but I didn't notice a difference myself (claim had to do with auto size measuring)

MaxWidth="2560"
MaxHeight="1600"

Also never put a DataGrid in a ScrollViewer, because you will essentially lose virtualization. Let me know if this helps!

Rajat Ghalni

Check if you have property ScrollViewer.CanContentScroll set False. Setting this property to false disables the virtualization in a way will degrade the performance of your Data-grid. For more clarification refer this CanContentScroll

Maybe try this instead of loading all 50 rows at once

http://www.codeproject.com/Articles/34405/WPF-Data-Virtualization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!