Procházet zdrojové kódy

Fix: Removing Border from parent alters border brush

When border is removed from parent, BorderBrush and Background are set to default. However, if they were null in first place, that alters Border behaviour if you re-add the view back later. Altering happens because null is treated as 'Take border color from parent scheme' and default is treated as 'Use black'
Maxim před 2 roky
rodič
revize
f57b647ab0
1 změnil soubory, kde provedl 8 přidání a 2 odebrání
  1. 8 2
      Terminal.Gui/Core/Border.cs

+ 8 - 2
Terminal.Gui/Core/Border.cs

@@ -445,8 +445,14 @@ namespace Terminal.Gui {
 
 		private void Parent_Removed (View obj)
 		{
-			BorderBrush = default;
-			Background = default;
+			if (borderBrush != null)
+			{
+				BorderBrush = default;
+			}
+			if (background != null)
+			{
+				Background = default;
+			}
 			child.Removed -= Parent_Removed;
 		}