Table of Contents

Method SetExpandedAndKeepPosAndSelection

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

SetExpandedAndKeepPosAndSelection(TreeViewItem?, bool)

Expands or collapses the specified TreeViewItem while preserving the current scroll position and selection.

public virtual void SetExpandedAndKeepPosAndSelection(TreeViewItem? item, bool expanded)

Parameters

item TreeViewItem

The TreeViewItem to expand or collapse. If item is null or does not have child items, the method does nothing.

expanded bool

true to expand the item; false to collapse it.

Remarks

This method ensures that the scroll position and the selected item in the associated ListBox remain unchanged after the operation.