private void btnAddCar_Click(object sender, RoutedEventArgs e) { var maxCount = _cars?.Max(x => x.CarId) ?? 0; _cars?.Add(new Inventory { CarId = ++maxCount, Color = "Yellow", Make = "VW", PetName = "Birdie", IsChanged = false }); }