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