开发者

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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜