示例#1
0
        private void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            int pos = DataGrid.SelectedIndex;

            if (pos == -1)
            {
                MessageBox.Show("Seleccione un material", "Error");
                return;
            }

            MyItem item;

            try
            {
                item = (MyItem)DataGrid.SelectedItem;
            }
            catch (InvalidCastException)
            {
                return;
            }
            ItemForm window = new ItemForm((MyItem)item.Clone(), pos);

            window.ShowDialog();
        }
示例#2
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            ItemForm window = new ItemForm();

            window.ShowDialog();
        }