diff --git a/src/Spectre.Console/Widgets/Tree.cs b/src/Spectre.Console/Widgets/Tree.cs index 289884e..859b53f 100644 --- a/src/Spectre.Console/Widgets/Tree.cs +++ b/src/Spectre.Console/Widgets/Tree.cs @@ -23,10 +23,19 @@ public sealed class Tree : Renderable, IHasTreeNodes /// public List Nodes => _root.Nodes; + private bool _expanded { get; set; } = true; /// /// Gets or sets a value indicating whether or not the tree is expanded or not. /// - public bool Expanded { get; set; } = true; + public bool Expanded + { + get => _expanded; + set + { + _expanded = value; + _root.Expand(value); + } + } /// /// Initializes a new instance of the class.