예제 #1
0
        private DatasetViewModel(Dataset dataset, DatasetViewModel parent)
        {
            this.dataset = dataset;
            this.parent = parent;

            children = new ObservableCollection<DatasetViewModel>(
                    (from child in dataset.Children
                     select new DatasetViewModel(child, this))
                     .ToList());
        }
        private void btnNewDataset_Click(object sender, RoutedEventArgs e)
        {
            if (datasetView.SelectedItem == null)
            {
                MessageBox.Show("Select an existing entry first.");
                return;
            }

            var dsvmParent = (DatasetViewModel)datasetView.SelectedItem;

            DatasetViewModel dsvm = new DatasetViewModel(Model.GetNewDataset(dsvmParent.Dataset));

            dsvmParent.Children.Add(dsvm);
            dsvmParent.IsExpanded = true;
            dsvmParent.IsSelected = false;
            dsvm.IsSelected = true;
        }