Browse Source

Reset the ListView when the source is defined.

BDisp 5 years ago
parent
commit
82f95504ce
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Terminal.Gui/Views/ListView.cs

+ 2 - 0
Terminal.Gui/Views/ListView.cs

@@ -120,6 +120,7 @@ namespace Terminal.Gui {
 				source = value;
 				source = value;
 				top = 0;
 				top = 0;
 				selected = 0;
 				selected = 0;
+				lastSelectedItem = -1;
 				SetNeedsDisplay ();
 				SetNeedsDisplay ();
 			}
 			}
 		}
 		}
@@ -210,6 +211,7 @@ namespace Terminal.Gui {
 				if (selected < 0 || selected >= source.Count)
 				if (selected < 0 || selected >= source.Count)
 					throw new ArgumentException ("value");
 					throw new ArgumentException ("value");
 				selected = value;
 				selected = value;
+				OnSelectedChanged ();
 				if (selected < top)
 				if (selected < top)
 					top = selected;
 					top = selected;
 				else if (selected >= top + Frame.Height)
 				else if (selected >= top + Frame.Height)