using System.Collections.ObjectModel; using System.Linq; namespace WpfTreeView { /// /// The view model for the applications main Directory view /// public class DirectoryStructureViewModel : BaseViewModel { #region Public Properties /// /// A list of all directories on the machine /// public ObservableCollection Items { get; set; } #endregion #region Constructor /// /// Default constructor /// public DirectoryStructureViewModel() { // Get the logical drives var children = DirectoryStructure.GetLogicalDrives(); // Create the view models from the data this.Items = new ObservableCollection( children.Select(drive => new DirectoryItemViewModel(drive.FullPath, DirectoryItemType.Drive))); } #endregion } }