1
1
Эх сурвалжийг харах

Fix window width validation to avoid setting invalid MinWidth and MaxWidth

Ruben 4 сар өмнө
parent
commit
a6b9e7865a

+ 5 - 1
src/PicView.Avalonia/UI/GenericWindowHelper.cs

@@ -48,7 +48,11 @@ public static class GenericWindowHelper
     {
         window.Loaded += delegate
         {
-            window.MinWidth = window.MaxWidth = window.Width;
+            if (!double.IsNaN(window.Width) && !double.IsInfinity(window.Width))
+            {
+                window.MinWidth = window.MaxWidth = window.Width;
+            }
+            
             window.Title = title;
         };
         window.KeyDown += (_, e) =>