Table of Contents

Method ToggleExpandedAndCollapseSiblings

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

ToggleExpandedAndCollapseSiblings(TreeViewItem?, bool)

Toggles the expanded state of the specified tree item and optionally collapses its sibling items. If collapseSiblings is true and the item has a parent, all sibling items are collapsed before toggling.

public virtual bool ToggleExpandedAndCollapseSiblings(TreeViewItem? item, bool collapseSiblings)

Parameters

item TreeViewItem

The target tree item to expand or collapse.

collapseSiblings bool

Indicates whether sibling items under the same parent should be collapsed before expanding the target item.

Returns

bool

true if the toggle action was successfully applied; false if the item is null or has no child items.

Remarks

This method is typically used during user interactions to enforce exclusive expansion behavior. It does not apply collapse logic if the item has no parent or if collapseSiblings is false.