private void RandomizeData() { for (var i = 0; i < 10; i++) { UnitMeasures.Add(new UnitMeasure( (i + 1), RandomHelper.RandomString(10, true)) ); } }
private void OnCreateUnit(UnitMeasure um) { if (um.ID < 1) { um.ID = UnitMeasures.Max(u => u.ID) + 1; } UnitMeasure umNew = new UnitMeasure(um); UnitMeasures.Add(umNew); ICollectionView dataView = CollectionViewSource.GetDefaultView(UnitMeasures); dataView.MoveCurrentTo(umNew); }