Exemple #1
0
        private void UpdatePreview()
        {
            if (_previewChild != null)
            {
                _previewChild.PropertyChanged -= PreviewPropertyChanged;
            }

            if (_children.Count == 0)
            {
                Icon = null;
                OnPropertyChanged("Icon");

                return;
            }

            _previewChild = _children.First();
            _previewChild.PropertyChanged += PreviewPropertyChanged;

            if (IsSelected)
            {
                Icon = null;
                OnPropertyChanged("Icon");
            }
            else
            {
                Icon = _previewChild.Icon;
                OnPropertyChanged("Icon");
            }
        }
Exemple #2
0
 protected void OnSelectionChanged(AppTreeNode sender)
 {
     if (SelectionChanged != null)
     {
         SelectionChanged(sender);
     }
 }
Exemple #3
0
        public void AddChild(AppTreeNode item)
        {
            item.SelectionChanged += OnSelectionChanged;
            item.Parent            = this;
            _children.Add(item);

            if (_enablePreview)
            {
                UpdatePreview();
            }
        }
Exemple #4
0
        public bool RemoveChild(AppTreeNode item)
        {
            item.SelectionChanged -= OnSelectionChanged;
            item.Parent            = null;
            var result = _children.Remove(item);

            if (_enablePreview)
            {
                UpdatePreview();
            }
            return(result);
        }