This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I've noticed that setting DataGrid columns' width to "Auto" has a significant performance impact. I had a particular grid with nearly 50 columns and about 500 rows of data. All of the columns were set to Width="Auto", and it was taking nearly 5 seconds to paint. When I set a fixed width on all of the columns, it would paint in less than a second. I did briefly profile the code and nearly 70% of the processing time was spent in the System.Windows.UIElement.Measure(System.Windows.Size). I'm not sure if there is something that could be done on your end to help performance in this area.? I'm sure hoping that there is. I've had to abandon the auto-size feature in several instances because of the performance penalty. Thanks. |
|
|
Hello Jared Indeed the auto sizing feature doesn't have the greatest performance. The reason for this is twofold: Firstly, automatically calculating the width of every cell has a lot of overhead - compared to absolute sizing where the size is instantly known. Secondly, when one of the columns is auto sizing, we've disabled column virtualization. If all the columns can fit into the viewport, then there generally won't be too much of a performance issue. But with 50 columns with the column-virtualization disabled there is a problem. The reason we have disabled column virtualization is because when the columns are auto sized, we can not calculate the position of the viewport and scroll extent unless all the column widths are known. Hence column virtualization is disabled so all column widths can be calculated. You can see that if all columns use absolute sizing, the column positions and total column widths are known. I'm sure there is a way to work around this, but I haven't worked this out yet. There is probably a trick to sacrifice scroll bar accuracy to estimate the virtualization. This is certainly something we will look into. For now you'll either need to use absolute sizing, or have fewer columns in some data grids. Jason Fauchelle |
|
|
Thank you for the response. I understand the issues involved. I would think that there would be a decent way of estimating column widths until they are scrolled into view and the actual width could then be calculated (updating the scrolling). I appreciate you looking into it and responding with the hurdles that would have to be crossed. I'm fine for now working around the performance issues. With that said, I'd also like to see this improved in the future. Thanks for all you do! |
|