From b31f7385dc79debc8fe5d6111d18ea016cd83d5f Mon Sep 17 00:00:00 2001 From: ahopper Date: Mon, 5 Mar 2018 07:55:16 +0000 Subject: [PATCH] Allow progressbar width and height less than default --- src/Avalonia.Controls/ProgressBar.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Controls/ProgressBar.cs b/src/Avalonia.Controls/ProgressBar.cs index 8cf6b149cb..19744d3038 100644 --- a/src/Avalonia.Controls/ProgressBar.cs +++ b/src/Avalonia.Controls/ProgressBar.cs @@ -90,16 +90,16 @@ namespace Avalonia.Controls { if (orientation == Orientation.Horizontal) { - MinHeight = 14; - MinWidth = 200; + MinHeight = Math.Min(14, double.IsNaN(Height) ? double.MaxValue : Height); + MinWidth = Math.Min(200, double.IsNaN(Width) ? double.MaxValue : Width); _indicator.HorizontalAlignment = HorizontalAlignment.Left; _indicator.VerticalAlignment = VerticalAlignment.Stretch; } else { - MinHeight = 200; - MinWidth = 14; + MinHeight = Math.Min(200, double.IsNaN(Height) ? double.MaxValue : Height); + MinWidth = Math.Min(14, double.IsNaN(Width) ? double.MaxValue : Width); _indicator.HorizontalAlignment = HorizontalAlignment.Stretch; _indicator.VerticalAlignment = VerticalAlignment.Bottom;