Browse Source

Correctly subtracted the minimum from the value and the divisor.

pull/62/head
Nelson Carrillo 11 years ago
parent
commit
08ca269a09
  1. 10
      Perspex.Controls/ProgressBar.cs

10
Perspex.Controls/ProgressBar.cs

@ -16,13 +16,15 @@ namespace Perspex.Controls
public class ProgressBar : RangeBase
{
/// <inheritdoc/>
///
private Border indicator;
protected override Size ArrangeOverride(Size finalSize)
{
var size = base.ArrangeOverride(finalSize);
var b = this.Bounds;
var indicator = this.GetTemplateChild<Border>("PART_Indicator");
indicator.Width = Math.Max(this.Minimum, finalSize.Width * (this.Value / this.Maximum));
this.indicator = this.indicator ?? this.GetTemplateChild<Border>("PART_Indicator");
double percent = this.Maximum == this.Minimum ? 1.0 : (this.Value - this.Minimum) / (this.Maximum - this.Minimum);
indicator.Width = finalSize.Width * percent;
return size;
}

Loading…
Cancel
Save