From 4716a879a3f98dbb25ef4f970e493d59efccd1b4 Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 15 Jul 2020 18:24:16 +0100 Subject: [PATCH] Fixes #226. Added a Initialize method to constructors. --- Terminal.Gui/Views/ListView.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index cb8aeb6e6..a9de56f96 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -238,8 +238,8 @@ namespace Terminal.Gui { /// the "Source" property to reset the internal settings of the ListView. public ListView (IListDataSource source) : base () { - Source = source; - CanFocus = true; + this.source = source; + Initialize (); } /// @@ -247,6 +247,7 @@ namespace Terminal.Gui { /// public ListView () : base () { + Initialize (); } /// @@ -256,6 +257,7 @@ namespace Terminal.Gui { /// An IList data source, if the elements of the IList are strings or ustrings, the string is rendered, otherwise the ToString() method is invoked on the result. public ListView (Rect rect, IList source) : this (rect, MakeWrapper (source)) { + Initialize (); } /// @@ -264,6 +266,12 @@ namespace Terminal.Gui { /// Frame for the listview. /// IListDataSource object that provides a mechanism to render the data. The number of elements on the collection should not change, if you must change, set the "Source" property to reset the internal settings of the ListView. public ListView (Rect rect, IListDataSource source) : base (rect) + { + this.source = source; + Initialize (); + } + + void Initialize () { Source = source; CanFocus = true;