public void AddRow(List <FaiItem> faiItems, ProductLevel productLevel, string rowName) { // Sort fai items by header order var values = new List <FaiItem>(); foreach (var faiName in _header) { values.Add(faiItems.First(item => item.Name == faiName).Clone()); } var row = new DataRowViewModel() { Values = values, RowName = rowName, ProductLevel = productLevel }; ValueMatrix.Add(row); OnPropertyChanged(nameof(Rows)); OnNewRowAdded(row); if (Rows > MaxRows) { RemoveMultipleRows(); } }
protected virtual void OnNewRowAdded(DataRowViewModel newRow) { NewRowAdded?.Invoke(newRow); }