protected void SetRootNodes(IEnumerable <TreeViewItemViewModel> source, string defaultText = "")
 {
     _currentRootNodesViewModel = source.ToList();
     if (_currentRootNodesViewModel.Count == 0 && !string.IsNullOrEmpty(defaultText))
     {
         _currentRootNodesViewModel.Add(new TextItemViewModel(_imageSourceFactory, null, defaultText));
     }
     _rootNodes.Clear();
     _currentRootNodesViewModel.ForAll(x => _rootNodes.Add(x));
 }
        protected void SetRootNodes(List <TreeViewItemViewModel> newRootNodes)
        {
            // Don't update if we are passed in the already active collection.
            if (object.ReferenceEquals(_activeRootNodes, newRootNodes))
            {
                return;
            }
            _activeRootNodes = newRootNodes;

            // Move the active root nodes into the observable collection so that
            // the TreeView is refreshed.
            _rootNodes.Clear();
            foreach (var child in _activeRootNodes)
            {
                _rootNodes.Add(child);
            }

            this.OnRootNodesChanged();
        }