private void addButton_Click(object sender, RoutedEventArgs e) { NewPhoto = new Photograph( titleTextBox.Text, artistTextBox.Text, takenDatePicker.SelectedDate.Value, descriptionTextBox.Text, imagePathTextBox.Text, keywordsTextBox.Text.Split(',').Select(keyword => keyword.Trim()).ToArray() ); this.DialogResult = true; }