Example #1
0
 public EmployeeProjectsView(EmployeeProjectsViewModel employeeProjectsViewModel, EmployeeProjectsViewModel employeeProjectsViewModel1)
 {
     InitializeComponent();
     this.DataContext = employeeProjectsViewModel;
     this.employeeProjectsViewModel = employeeProjectsViewModel1;
     this.employeeProjectsViewModel.PropertyChanged += EmployeeProjectsViewModel_PropertyChanged;
 }
        public EmployeeProjectsView(EmployeeProjectsViewModel employProjectsViewModel)
        {
            InitializeComponent();

            DataContext = employProjectsViewModel;

            RegionContext.GetObservableContext(this).PropertyChanged += (sender, e) =>
                                                                        employProjectsViewModel.CurrentEmployee = RegionContext.GetObservableContext(this).Value as Employee;
        }
        public EmployeeProjectsView(EmployeeProjectsViewModel employeeProjectsViewModel)
        {
            this.InitializeComponent();

            // Set the ViewModel as this View's data context.
            this.DataContext = employeeProjectsViewModel;

            // TODO: 09 - Whenever the RegionContext value is changed, the newly selected employee is set on the view model for each child window.
            // This view is displayed in a region with a region context.
            // The region context is defined as the currently selected employee
            // When the region context is changed, we need to propogate the
            // change to this view's view model.
            RegionContext.GetObservableContext(this).PropertyChanged += (s, e)
                                                                        =>
                                                                        employeeProjectsViewModel.CurrentEmployee =
                RegionContext.GetObservableContext(this).Value
                as Employee;
        }