protected TreeViewItemViewModel(TreeViewItemViewModel parent, bool lazyLoadChildren) { _parent = parent; _children = new ObservableCollection <TreeViewItemViewModel>(); if (lazyLoadChildren) { _children.Add(DummyChild); } }
/// <summary> /// Event handler called when an item has been selected on the media tree. The handler is always /// called no matter which item has been selected, but only media song title items are considered /// for operations in this handler. /// </summary> /// <param name="item">The item selected</param> void TreeViewItemViewModel_OnItemSelected(TreeViewModel.TreeViewItemViewModel item) { if (item != null) { // Cast the base item coming in to a more specific title item. If the // cast is successful, continue. TreeViewModel.TitleViewModel title = item as TreeViewModel.TitleViewModel; if (title != null) { // Load the view model for the detaile control using the path and file name mediaDetailsControl.LoadViewModel(title.FilePath + "\\" + title.FileName); } } }