public HydroPlantsDataGrid(EntitiesCollections entitiesCollections) : base(entitiesCollections) { InitializeComponent(); HydroPlantsCollectionViewModel items = ItemsSource as HydroPlantsCollectionViewModel; if (items.Count == 1) { HydroPlantViewModel item = items[0] as HydroPlantViewModel; if (item.Name == null) { CurrentColumn = NameColumn; NameColumn.IsReadOnly = false; CaseColumn.IsReadOnly = false; } } }
public HydroPlantsCollectionViewModel GetObjects() { UIObjects = new HydroPlantsCollectionViewModel(); List <HydroPlant> dataObjects = HydroPlantsDataAccess.GetObjects(); foreach (HydroPlant dataObject in dataObjects) { UIObjects.Add(new HydroPlantViewModel(dataObject)); } if (UIObjects.Count == 0) { UIObjects.Add(new HydroPlantViewModel()); } UIObjects.ItemEndEdit += new ItemEndEditEventHandler(ObjectsItemEndEdit); UIObjects.CollectionChanged += new NotifyCollectionChangedEventHandler(ObjectsCollectionChanged); return(UIObjects); }