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