private void AddButton_Click(object sender, RoutedEventArgs e) { var x = (sender as Button).DataContext as SpiritListViewModel; var spirit = new SpiritViewModel() { Title = "new Spirit." }; x.List.Add(spirit); SpiritWindow.Show(spirit, x.List); }
public void Show(SpiritViewModel data, ObservableCollection <SpiritViewModel> spirits) { this.DataContext = data; this.Spirits = spirits; this.Show(); }