Skip to content

Commit

Permalink
Add SharpTreeNode.OnParentChanged() callback
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Nov 18, 2024
1 parent 53cf07c commit fd285e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ICSharpCode.ILSpyX/TreeView/SharpTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ public bool IsSelected {

#endregion

#region OnChildrenChanged
#region OnParentChanged / OnChildrenChanged
public virtual void OnParentChanged()
{ }

public virtual void OnChildrenChanged(NotifyCollectionChangedEventArgs e)
{
if (e.OldItems != null)
Expand All @@ -190,6 +193,7 @@ public virtual void OnChildrenChanged(NotifyCollectionChangedEventArgs e)
{
Debug.Assert(node.modelParent == this);
node.modelParent = null;
node.OnParentChanged();
Debug.WriteLine("Removing {0} from {1}", node, this);
SharpTreeNode removeEnd = node;
while (removeEnd.modelChildren != null && removeEnd.modelChildren.Count > 0)
Expand Down Expand Up @@ -227,6 +231,7 @@ public virtual void OnChildrenChanged(NotifyCollectionChangedEventArgs e)
{
Debug.Assert(node.modelParent == null);
node.modelParent = this;
node.OnParentChanged();
node.UpdateIsVisible(isVisible && isExpanded, false);
//Debug.WriteLine("Inserting {0} after {1}", node, insertionPos);

Expand Down

0 comments on commit fd285e3

Please sign in to comment.