Kevin Mark
Kevin Mark

Reputation: 1671

Multiple Progress Bar States in WPF

I'm currently developing a WPF application in C# and I want to have a progress bar control that can be in a "paused" state as well as an "error" state. Much like this: http://wyday.com/windows-7-progress-bar/ Unfortunately, that's a Windows Forms control and implementing it via a Windows Forms Host proved to be incompatible.

My question is, how can I go about accomplishing a similar effect in WPF? Is it possible to make multiple "states" of a progress bar? Is this kind of operation in WPF but I'm just looking over it? I'm mainly talking about the progress bar itself here, I'm pretty sure I know how to achieve this in the taskbar.

All help is appreciated, especially code examples. Thanks!

Upvotes: 1

Views: 3432

Answers (1)

Jean Azzopardi
Jean Azzopardi

Reputation: 2289

It's certainly easy to change the color and style of the WPF Progress Bar, if that's what you mean.

Marquee Style = progressBar1.IsIndeterminate = true;

Error State = progressBar1.Foreground = Brushes.Red;

Paused State = progressBar1.Foreground = Brushes.Yellow;

Normal State =

            Brush newBrush = new SolidColorBrush(){Color = new Color(){A = 255, R = 1, G = 211,B=28}};
            progressBar1.Foreground = newBrush;

Note that I am not really that up to date with the progress bar colors, you might have to experiment a bit with the values above to get it just right.

Upvotes: 2

Related Questions