浏览代码

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 年之前
父节点
当前提交
f57b647ab0
共有 1 个文件被更改,包括 8 次插入2 次删除
  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)
 		private void Parent_Removed (View obj)
 		{
 		{
-			BorderBrush = default;
-			Background = default;
+			if (borderBrush != null)
+			{
+				BorderBrush = default;
+			}
+			if (background != null)
+			{
+				Background = default;
+			}
 			child.Removed -= Parent_Removed;
 			child.Removed -= Parent_Removed;
 		}
 		}