-1

How can I change the style of a progressbar in WPF? On Windows 10 it's a straight bar, but in win 7 it's splitted in many small blocks. I want to have the bar straight as on win 10, when the application is used on win 7

Benny Alex
  • 131
  • 2
  • 12
  • 2
    Possible duplicate of [WPF progressbar style](http://stackoverflow.com/questions/4815175/wpf-progressbar-style) – MikeT Mar 29 '17 at 09:42
  • What have you tried till now ? – Versatile Mar 29 '17 at 12:27
  • NOTE: There's a library called MahApps.Metro that styles all the controls to be the more modern metro theme. You might want to look into that. Source code is available on GitHub. – Berin Loritsch Mar 29 '17 at 12:28

3 Answers3

1

I just lookng for a property like 'ugly-block-spacing' which I can set. Or do I have really define the whole style new?

Yes, I am afraid you will have to re-define the entire ControlTemplate from scratch. You cannot override only a part of a ControlTemplate:

WPF: Is there a way to override part of a ControlTemplate without redefining the whole style?

But you could copy the default ControlTemplate by right-clicking on a ProgressBar in design mode in Visual Studio on a Windows 10 computer, edit it as per your requirements and then use style i your application instead of the default one.

Community
  • 1
  • 1
mm8
  • 163,881
  • 10
  • 57
  • 88
0

Progressbar has a property called Style, you could set it to your liking.

Adarsh Ravi
  • 893
  • 1
  • 16
  • 39
  • but then I need much code. I just lookng for a property like 'ugly-block-spacing' which I can set. Or do I have really define the whole style new? – Benny Alex Mar 29 '17 at 09:50
0

If you give Metro a try, you could use somthing like this:

<metro:MetroProgressBar x:Name="pbar" Value="50" Height="20"></metro:MetroProgressBar>

If you want to use the normal bar with Metro Style:

<ProgressBar x:Name="pbar" Value="50" Height="20" Style="{StaticResource MetroProgressBar}"></ProgressBar>

Same without Style:

<ProgressBar x:Name="pbar" Value="60" Height="20" Style="{x:Null}"></ProgressBar>

If you want to know more about Metro, you can find it here

Julian
  • 886
  • 10
  • 21