From 4790a52639b818a96fe07a2b4e7d97a55f88d3dd Mon Sep 17 00:00:00 2001 From: Ross Ferguson Date: Tue, 30 Jun 2020 17:49:41 +0100 Subject: [PATCH] ComboBox. Use SuperView to determine if control has been added to a container view --- Terminal.Gui/Views/ComboBox.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 5dc91e829..803b12f4a 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -29,7 +29,8 @@ namespace Terminal.Gui { set { source = value; - if(isAdded) { + // Only need to refresh list if its been added to a container view + if(SuperView != null && SuperView.Subviews.Contains(this)) { Search_Changed (""); SetNeedsDisplay (); } @@ -66,7 +67,6 @@ namespace Terminal.Gui { readonly TextField search; readonly ListView listview; bool autoHide = true; - bool isAdded; /// /// Public constructor @@ -163,8 +163,6 @@ namespace Terminal.Gui { } else { search.ColorScheme = Colors.Menu; } - - isAdded = true; }; }