Browse Source

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 2 years ago
parent
commit
f57b647ab0
1 changed files with 8 additions and 2 deletions
  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;
 		}