public EditWindow(Service.Service service, int rowIndex, object selectedItem, DataGrid grid) { InitializeComponent(); this.selectedItem = selectedItem; this.service = service; this.rowIndex = rowIndex; this.grid = grid; this.grid.IsReadOnly = true; List<String> categories = new List<String>(); categories.Add("Discount pris"); categories.Add("Hverdags oste"); categories.Add("Luxus oste"); categories.Add("Eksklusive oste"); categories.Add("Styk ost"); categories.Add("Osteborde"); comboBoxCategoryEdit.ItemsSource = categories.ToList(); TxtName.Text = service.filldata(service.getProducts()).Rows[rowIndex]["name"].ToString(); txtUnitprice.Text = service.filldata(service.getProducts()).Rows[rowIndex]["unitPrice"].ToString(); txtCountAvailable.Text = service.filldata(service.getProducts()).Rows[rowIndex]["countAvailable"].ToString(); txtCountry.Text = service.filldata(service.getProducts()).Rows[rowIndex]["country"].ToString(); txtDescription.Text = service.filldata(service.getProducts()).Rows[rowIndex]["description"].ToString(); }
public MainWindow() { InitializeComponent(); service = new Service.Service(); grid.ItemsSource = service.getProducts(); grid.CanUserAddRows = false; grid.IsReadOnly = true; boxProducts.ItemsSource = service.getProducts(); gridPackage = new DataGrid(); gridPackage.ItemsSource = db.Packages.ToList(); gridPackage.CanUserAddRows = false; gridPackage.IsReadOnly = true; gridFAQ.ItemsSource = db.FAQs.ToList(); gridFAQ.CanUserAddRows = false; gridFAQ.IsReadOnly = true; }