I want to save the expansion state of my TreeListView before I reload the data and I use the following code:
foreach (var item in _currentTreeListView.Items) { if (_currentTreeListView.IsExpanded(item)) { expandedItems.Add(item); } } // Data update and TreeListView reload foreach (var item in expandedItems) { _currentTreeListView.ExpandHierarchyItem(item); }
But _currentTreeListView.IsExpanded(item) returns false no matter if the corresponding item is expanded in the TreeListView. What's the problem?