Wednesday, 5 October 2011

WPF: Binding example (Part 6)

This post deals with performance problems with DataGrids.

If you test the WPF Task Manager application we have been developing in last few posts, you will notice that we experience a lag when we scroll the process grid – or click the grid to open its row details containing the threads.

There is a concept of ‘virtualization’ in WPF. It basically means the UI object which is not shown on the screen is virtualized or to say taken out of memory. This reduces the no. of objects which is supposed to improve performance.

Grid has two properties which change the virtualization - EnableRowVirtualization and EnableColumnVirtualization.

By default: EnableRowVirtualization is true and EnableColumnVirtualization is false. This is why when you scroll down or up quite quickly you notice a lag – the virtualized objects are being brought to life when they become visible.

In WPF task manager if we change the value EnableRowVirtualization to false (it is true be default) you will notice a considerable improvement in performance. We can set this on inner grid as well.

I think WPF is still doing some operations (could be lazy load) – because if you click a row for the first time and its row details open up, and then if you do it again the row details show up much faster compared to first time.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

C# Reactive Extensions - Buffer and Window

I was going through Buffer and Window in RX, thought a few examples would help clear the differences. First create a buffer of even numbe...