private void OnAdd(object sender, RoutedEventArgs e) { ActiveInventoryObject aio = new ActiveInventoryObject(); aio.Model = "New Item"; Inventory.Add(aio); FilteredInventory.Add(aio); }
void ResetFilter() { FilterSKU = string.Empty; FilterName = string.Empty; FilterUPC = string.Empty; FilteredInventory.Clear(); foreach (ActiveInventoryObject aio in Inventory) { FilteredInventory.Add(aio); } }
void DoFilter(string propertyName, string value) { if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(propertyName)) { List <ActiveInventoryObject> aioList = new List <ActiveInventoryObject>(FilteredInventory); string cmp = value.ToUpperInvariant(); FilteredInventory.Clear(); foreach (ActiveInventoryObject aio in aioList) { string entry = typeof(ActiveInventoryObject).GetProperty(propertyName).GetValue(aio, null) as string; if (entry.ToUpperInvariant().Contains(cmp)) { FilteredInventory.Add(aio); } } } }