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