WPF / Windows 7: Disable Default Progress Bar Glow Animation

Brandon picture Brandon · Oct 6, 2009 · Viewed 12.7k times · Source

Quick WPF question - on Win 7 (and I assume Vista) in WPF, the default progress bar does a nice little glowing "whoosh"-y animation.

I'm showing progress of about 48 things on one screen, and it's a tad overwhelming to have all of these things whooshing on you - can you disable just these animations without affecting the rest of the default animations in the application?

Answer

Mark Cranness picture Mark Cranness · Aug 4, 2011

Robert's answer is robust. Here is a hack (because it relies on the internal name of the element that does the glow, which is an implementation detail and may change in a subsequent version):

void SetGlowVisibility(ProgressBar progressBar, Visibility visibility) {
    var glow = progressBar.Template.FindName("PART_GlowRect", progressBar) as FrameworkElement;
    if (glow != null) glow.Visibility = visibility;
}

If how a progress bar is implemented changes, this hack may stop working.

On the other hand, a solution that completely replaces the XAML and styles may lock-in and fix colours, borders etc. and disable behaviour that might be added to a newer version of the ProgressBar in the future...