protected override void OnBeforeExpand(VirtualTreeViewCancelEventArgs e) { if (TopNode == null) { _persistedTopNode = new List <object>(); } else { _persistedTopNode = TopNode.GetPersistenceInfo().Path; } base.OnBeforeExpand(e); }
/// <summary> /// We have to be a bit more clever now, as things can appear /// more than once in the treeview (ie Group by tag) /// /// Therefore we try and keep selection on the correct /// object, even during migration or moving between folders. /// In the case we can't, we default to its parent and its /// parent's parent and so on. /// </summary> public new void BeginUpdate() { // Save the selection... _persistedSelectionInfo = new List <VirtualTreeNode>(SelectedNodes).ConvertAll(n => n.GetPersistenceInfo()); // Save the scroll position.. if (TopNode == null) { _persistedTopNode = new List <object>(); } else { _persistedTopNode = TopNode.GetPersistenceInfo().Path; } }