public void LoadExpansionState(ITreeViewModelItem item)
        {
            var itemPath = item.CreatePath();

            if (ExpansionStates.ContainsKey(itemPath))
            {
                item.IsExpanded = ExpansionStates[itemPath];
            }
        }
        public void SaveExpansionState(ITreeViewModelItem item)
        {
            var itemPath = item.CreatePath();

            if (ExpansionStates.ContainsKey(itemPath))
            {
                ExpansionStates[itemPath] = item.IsExpanded;
            }
            else
            {
                ExpansionStates.Add(itemPath, item.IsExpanded);
            }
        }
        public void CleanUp()
        {
            CleanUpRequests++;
            if (CleanUpRequests < 10)
            {
                return;
            }

            var allItemPaths = Owner.Items.Select(o => o.CreatePath()).ToList();

            foreach (var state in ExpansionStates.ToList())
            {
                if (!allItemPaths.Contains(state.Key))
                {
                    ExpansionStates.Remove(state.Key);
                }
            }

            CleanUpRequests = 0;
        }
Beispiel #4
0
 /// <summary>
 ///     Sets the state of to toolbar.
 /// </summary>
 private void GoToToolbarState(ExpansionStates state, bool useTransition = true)
 {
     VisualStateManager.GoToState(this, state.ToString(), useTransition);
 }