private FolderTreeItemViewModel(DirectoryInfo dirInfo, FolderTreeItemViewModel parent, IEventAggregator eventAggregator) { if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } _absolutePath = dirInfo.FullName; _parent = parent; _eventAggregator = eventAggregator; _children = new ObservableCollection <IFolderTreeItemViewModel>( (from child in dirInfo.GetDirectories() select new FolderTreeItemViewModel(child, parent: this, eventAggregator: eventAggregator)).ToList()); NotifyPropertyChanged(() => Children); NotifyPropertyChanged(() => ViewTitle); OpenPicturesInFolderCommand = new RelayCommand <object>(OnOpenPicturesInFolder); DropCommand = new RelayCommand <object>(OnDropCommand); }
public bool IsAParentTo(FolderTreeItemViewModel treeItem) { var parent = new DirectoryInfo(AbsolutePath).Parent; return(parent.FullName == treeItem.AbsolutePath); }