WPF DataGrid is very slow to render

后端 未结 10 2007
我在风中等你
我在风中等你 2020-12-23 02:30

I have tried using both a customized DataGrid as well as the stock one in WPF. I have tried populating them manually as well as through bindings. In both cases they are sl

10条回答
  •  無奈伤痛
    2020-12-23 02:41

    Well a little bit adding more (i know its very old topic, but still it helps someone)...

    I tried

    EnableColumnVirtualization="True" VirtualizingPanel.VirtualizationMode="Recycling"
    EnableRowVirtualization="True" 
    

    for DataGrid(AutoGenerateColumns="True") binding to DataTable.DefaultView() and No effect on speed, it was still horrible for Speed as well as for navigation between rows. Than, I came up with solution to set Fixed Height and Width of DataGrid. Additionally I also set

    RowHeight="23" 
    ScrollViewer.HorizontalScrollBarVisibility="Visible"
    ScrollViewer.VerticalScrollBarVisibility="Visible"
    

    This makes my page fill very fast... Instead of 2 min, now it takes hardly 10-12 seconds.

    Hope it helps someone.

    Note: I am using .Net 4.5

提交回复
热议问题