private void InsertButton_Click(object sender, RoutedEventArgs e) { Review newReview = new Review(); EditWindow window = new EditWindow(); window.DataContext = newReview; if (window.ShowDialog() == true) { Movie selectedMovie = _moviesList.SelectedItem as Movie; newReview.Movie = selectedMovie; _db.Reviews.InsertOnSubmit(newReview); _db.SubmitChanges(); ((IList <Review>)_reviewsList.ItemsSource).Add(newReview); } }