private void UpdateGui(object sender, EventArgs e) { foreach (FrameworkElement fe in WpnlInventory.Children) { if (fe is InventoryTracker) { InventoryTracker car = (InventoryTracker)fe; car.CurrentValue = Db.GetInventory(car.CarName).ToString(); } } }
public void test() { string[] models = new string[] { "Toyota", "Honda", "Ford", "Nissan" }; Db.Init(models); foreach (string model in models) { //creates a user control InventoryTracker car = new InventoryTracker() { //sets the model for this user control CarName = model, //sets the start value for this control StartValue = Db.GetInventory(model).ToString() }; WpnlInventory.Children.Add(car); } }