private static void BuildGrid(Grid topContainer, ResourceDictionary resources) { var Context = topContainer.DataContext as EditorVM; topContainer.Children.Clear(); VM = new EditGridControlViewModel( resources, Context); Console.WriteLine($"LineEditControl, building new Grid for Index = {Context.SelectedItemIndex}."); topContainer.Children.Add(VM.GetEditLinesGridForNewCsvFile()); }
private static void CsvFileChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = (ConfigurationEditControl)d; var newValue = (CsvFile)e.NewValue; if (control == null || newValue == null) { return; } VM = new EditGridControlViewModel( control.Resources, control.DataContext as EditorVM, control.TopContainer); Console.WriteLine($"ConfigurationEditControl, new CsvFile set. Building new Grid for CsvFile: {Path.GetFileName((control.DataContext as EditorVM).SelectedCsvFile.AbsPath)}"); control.TopContainer.Children.Clear(); control.TopContainer.Children.Add(VM.GetEditConfigurationsGridForNewCsvFile()); }