private void Edit_Click(object sender, RoutedEventArgs e) { if (dg.SelectedIndex > -1) { PostsDialog dialog = new PostsDialog(mode.Update, this, (int)dg.SelectedValue); dialog.ShowDialog(); } else { MessageBox.Show("Не выбрано поле!"); } }
private void add_Click(object sender, RoutedEventArgs e) { PostsDialog dialog = new PostsDialog(mode.Add, this); dialog.ShowDialog(); }
private void Dg_MouseDoubleClick(object sender, MouseButtonEventArgs e) { PostsDialog dialog = new PostsDialog(mode.Update, this, (int)dg.SelectedValue); dialog.ShowDialog(); }