1

It's like the old Sesame Street song, "One of these things isn't like the other."

I'm writing in WPF C# and I want to recycle some code I wrote a couple of years ago. In my old project I have a progress bar and here is what the properties look like: enter image description here

In my new project I just added a progress bar (easy peasy) and I wanted to recycle my old code for changing the color of the bar based on value and some other stuff. But this is what the properties look like for this new progress bar: enter image description here

So, what's going on? No MarqueeAnimationSpeed, no Step value (in the new progress bar)!?!? Also, it throws an error when I try to set the ForeColor.

I'm using Visual Studio 2010 for both projects. They're both WPF, C#. But, clearly these two progress bars are very different. I want the new progress bar to look and act like the old progress bar.

What am I doing wrong?

Thanks.

zetar
  • 1,225
  • 2
  • 20
  • 45
  • 2
    Your "old" application is WinForms, not WPF - note the type `System.Windows.Forms.ProgressBar`. – BJ Myers Apr 24 '16 at 22:45
  • Possible duplicate of [How do I make a marquee progress bar in WPF?](http://stackoverflow.com/questions/638650/how-do-i-make-a-marquee-progress-bar-in-wpf) – BJ Myers Apr 24 '16 at 22:46

1 Answers1

3

The ProgressBar control in your old project is the WinForms variety. The ProgressBar control in your new project is the WPF kind.

You won't really be able to recycle your old code because the 2 platforms are very different.

Since you are using WPF you can create a ProgressBar in XAML like so:

<ProgressBar Width="201"
             Height="23"
             Maximum="100"/>

If you want a marquee effect you can set IsIndeterminate="True"

Or in C#:

ProgressBar progbar = new ProgressBar();
progbar.IsIndeterminate = true;
progbar.Orientation = Orientation.Horizontal;
progbar.Width = 201;
progbar.Height = 23;
Glen Thomas
  • 10,190
  • 5
  • 33
  • 65