private void editButton_Click(object sender, RoutedEventArgs e)
 {
     if (myDataGrid.SelectedItem == null)
     {
         MessageBox.Show("Choose an item to edit", "Edit an item", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         StockItemWindow w = new StockItemWindow();
         w.ItemToEdit = (StockEntryViewModel)myDataGrid.SelectedItem;
         w.InitEditForm();
         w.ShowDialog();
     }
 }
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            StockItemWindow w = new StockItemWindow();

            w.ShowDialog();
        }