Beispiel #1
0
        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;
                }
            }
        }
Beispiel #2
0
        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);
        }