public MainPage()
        {
            InitializeComponent();

            ViewModel = new TodoListViewModel(DataProvider.RetrieveValue<TodoItem[]>());
            DataContext = ViewModel;
            ViewModel.TodoItems.CollectionChanged += TodoItems_CollectionChanged;
        }
        public MainPage()
        {
            InitializeComponent();

            //TODO: 5.2 - Instantiate ViewModel passing DataProvider.RetrieveValue<TodoItem[]>() into the ctor of the ViewModel ctor
            // Set DataContext equal to ViewModel
            // Subscribe to ViewModel.TodoItems.CollectionChanged

            #region Solution 5.2
            ViewModel = new TodoListViewModel();
            //DataContext = ViewModel;
            ViewModel.TodoItems.CollectionChanged += TodoItems_CollectionChanged;
            #endregion
        }
Пример #3
0
        public MainPage()
        {
            InitializeComponent();

            //TODO: 5.2 - Instantiate ViewModel passing DataProvider.RetrieveValue<TodoItem[]>() into the ctor of the ViewModel ctor
            // Set DataContext equal to ViewModel
            // Subscribe to ViewModel.TodoItems.CollectionChanged

            #region Solution 5.2
            ViewModel = new TodoListViewModel();
            //DataContext = ViewModel;
            ViewModel.TodoItems.CollectionChanged += TodoItems_CollectionChanged;
            #endregion
        }