Search code examples
wpfprogress-barwpftoolkitregion

Why do collapsed elements still get marked as a dirty region, and rendered?


I noticed a slight performance hiccup when playing video and decided to profile it with the Perforator and fixed the issue easily but came across a conspicuous region being drawn very rapidly 100% of the time. I am worried this dirty region could hinder performance.

Here is the region It's the gray box, the screenshot happened to catch it between rendering.

Now I found the culprit -- a busy indicator (from WPFToolkit) with its visibility set to Collapsed. No other collapsed controls are rendering like this, so I must assume it's due to the ProgressBar IsIndeterminate flag.

Two questions:

  • Could this escalate to being a real issue for performance, or is this relatively common?
  • Would it be better to change its state out of IsIndeterminate = true ?

Solution

  • Animation in WPF produces dirty region even if it is collapsed or behind some elements. That's the known issue and could lead to performance degradation depending on elements count and animation resolution.

    I recommend you to stop animation while your progress indicator in not visible. This should help.