private void Modificar_Producto_Click(object sender, RoutedEventArgs e) { try { object selected = dataGrid_Productos.SelectedItem; string id = (dataGrid_Productos.SelectedCells[0].Column.GetCellContent(selected) as TextBlock).Text; string nombre = (dataGrid_Productos.SelectedCells[1].Column.GetCellContent(selected) as TextBlock).Text; //var fecha = (dataGrid_Productos.SelectedCells[1].Column.GetCellContent(selected) as DatePicker).SelectedDate; //string fecha = Convert.ToDateTime(dataGrid_Productos.SelectedCells[2].Column.GetCellContent(selected) as DatePickerFormat).ToString(); //string fecha = (dataGrid_Productos.SelectedCells[2].Column.GetCellContent(selected) as DatePicker).ToString(); string precio = (dataGrid_Productos.SelectedCells[3].Column.GetCellContent(selected) as TextBlock).Text; string stock = (dataGrid_Productos.SelectedCells[4].Column.GetCellContent(selected) as TextBlock).Text; string stock_cri = (dataGrid_Productos.SelectedCells[5].Column.GetCellContent(selected) as TextBlock).Text; string prove = (dataGrid_Productos.SelectedCells[6].Column.GetCellContent(selected) as TextBlock).Text; //string tipo = (dataGrid_Productos.SelectedCells[7].Column.GetCellContent(selected) as TextBlock).ToString(); AgregarProductosWpf mp = new AgregarProductosWpf(); mp.Txt_idamodificar_Producto.Text = id; mp.Txt_Nombre_Producto.Text = nombre; //mp.dt_Vencimiento_Producto = fecha.ToString("dd-MM-yyyy"); mp.Txt_Precio_Producto.Text = precio; mp.Txt_Stock_Producto.Text = stock; mp.Txt_StockCri_Producto.Text = stock_cri; //mp.Cbo_Proveedor_Producto.SelectedItem = prove; //mp.Cbo_TipoClase_Producto.SelectedItem = tipo; mp.Show(); } catch (Exception) { notifier.ShowWarning("Debe seleccionar el producto para modificar"); } }
private void Click_Agregar_Producto(object sender, RoutedEventArgs e) { AgregarProductosWpf produ = new AgregarProductosWpf(); produ.Show(); }