private void btn_Click_Edit_Customer(object sender, RoutedEventArgs e)
        {
            if (CustomerGrid.SelectedItems.Count == 1)
            {
                CustomerViewModel    rowViewModel = CustomerGrid.SelectedItem as CustomerViewModel;
                CustomerDetailWindow detailWindow = new CustomerDetailWindow();

                detailWindow.DataContext = rowViewModel.Clone();;

                DataGridViewModel gridViewModel = (DataGridViewModel)this.DataContext;
                rowViewModel.ParentGrid = gridViewModel;
                rowViewModel.DetailWindowDatacontext = detailWindow.DataContext;
                CustomerGrid.UnselectAllCells();
                bool?result = detailWindow.ShowDialog();
            }
            else
            {
                ShowMessageDialog("Kunde bearbeiten - Info", "Ein Datensatz muss zuvor selektiert werden", MessageDialogStyle.Affirmative);
            }
        }
        private void btn_Click_Update_Customers(object sender, RoutedEventArgs e)
        {
            CustomerGrid.CommitEdit();
            CustomerGrid.UnselectAllCells();
            DataGridViewModel gridViewModel = (DataGridViewModel)CustomerGrid.DataContext;

            try
            {
                if (gridViewModel.CustomersInfo.Count > 0)
                {
                    gridViewModel.UpdateAllCustomers();
                    CustomerGrid.DataContext = new DataGridViewModel();
                    var customersUpdated = ((DataGridViewModel)CustomerGrid.DataContext).CustomersInfo.Count();
                    ShowMessageDialog("Kunden aktualisiert", customersUpdated == 1 ? customersUpdated + " Datensatz wurde aktualisiert" : customersUpdated + " Datensätze wurden aktualisiert", MessageDialogStyle.Affirmative);
                }
            }
            catch (System.InvalidOperationException ex)
            {
                ShowMessageDialog("Sorting ist während einer AddNew- oder EditItem-Transaktion nicht zulässig.", "Aktualisierung erforderlich.", MessageDialogStyle.Affirmative);
            }
        }
 private void btn_Click_UnselectAllRows_Customer(object sender, RoutedEventArgs e)
 {
     CustomerGrid.UnselectAllCells();
 }