diff --git a/src/Spectre.Console/Prompts/List/ListPrompt.cs b/src/Spectre.Console/Prompts/List/ListPrompt.cs index f30f4d348..f83bb99f2 100644 --- a/src/Spectre.Console/Prompts/List/ListPrompt.cs +++ b/src/Spectre.Console/Prompts/List/ListPrompt.cs @@ -43,6 +43,18 @@ public ListPrompt(IAnsiConsole console, IListPromptStrategy strategy) using (new RenderHookScope(_console, hook)) { + Action disposal = () => { }; + foreach (var item in tree.Traverse()) + { + if (!(item.Data is INotifyPropertyChanged npc)) + { + continue; + } + + npc.PropertyChanged += (sender, args) => hook.Refresh(); + disposal += () => npc.PropertyChanged -= (sender, args) => hook.Refresh(); + } + _console.Cursor.Hide(); hook.Refresh(); @@ -66,6 +78,8 @@ public ListPrompt(IAnsiConsole console, IListPromptStrategy strategy) hook.Refresh(); } } + + disposal?.Invoke(); } hook.Clear();