0
votes

I am new in WPF and I realized that the ProgressBar accepts values that is greater than the Maximum while I am working on a circular progressbar. Even it is set, the Value automatically equalized to the Maximum. So I don't want to work such a progressbar. I think this is not a safe way for a good programming. Because it makes you not to figure out when a progress is calculated wrong or anything else. I was in Winforms before the WPF and Winform progressbars have a behavior as I am talking about.

I used this code and was expecting it to throw exception, but it did not.

 ProgressBar prbar = new ProgressBar();
 prbar.Maximum = 100;
 prbar.Value = 10000;

How can I make it to throw exception when Value is over Maximum like in Winforms C#?

1

1 Answers

1
votes

You can handle ValueChanged event of progressbar and check if value is grether than maximum value then you can raise exception manually.