예제 #1
0
        public void ViewModelExtensionsWithService6_T155859()
        {
            var parentVM = new ParentViewModel()
            {
                TestParameter = "parameter"
            };
            ChildViewModel      childVM    = new ChildViewModel();
            Grid                parentView = new Grid();
            Grid                childView;
            TestViewServiceBase service = new TestViewServiceBase();

            ((TestViewLocator)service.ViewLocator).AllowCaching = true;
            ITestViewServiceBase iService = service;

            Interactivity.Interaction.GetBehaviors(parentView).Add(service);
            Window.Content = parentView;
            EnqueueShowWindow();
            EnqueueCallback(() => {
                iService.CreateChildView("testViewWithViewModel", null, parentVM.TestParameter, parentVM);
            });
            EnqueueWindowUpdateLayout();
            EnqueueCallback(() => {
                parentVM.TestParameter = "parameter2";
                iService.CreateChildView("testViewWithViewModel", null, parentVM.TestParameter, parentVM);
            });
            EnqueueWindowUpdateLayout();
            EnqueueCallback(() => {
                childView = parentView.Children[0] as Grid;
                Assert.AreSame(parentVM, ((ISupportParentViewModel)childView.DataContext).ParentViewModel);
                Assert.AreEqual(parentVM.TestParameter, ((ISupportParameter)childView.DataContext).Parameter);
            });
            EnqueueTestComplete();
        }
예제 #2
0
        void Init_ViewModelExtensionsWithService_TestView(out ITestViewServiceBase service, out ChildViewModel childVM, out ParentViewModel parentVM)
        {
            parentVM = new ParentViewModel()
            {
                TestParameter = "parameter"
            };
            childVM = new ChildViewModel();
            Grid parentView = new Grid();

            service = new TestViewServiceBase();
            Interactivity.Interaction.GetBehaviors(parentView).Add((TestViewServiceBase)service);
            Window.Content = parentView;
        }
예제 #3
0
 public void ViewModelExtensionsWithService6_T155859() {
     var parentVM = new ParentViewModel() { TestParameter = "parameter" };
     ChildViewModel childVM = new ChildViewModel();
     Grid parentView = new Grid();
     Grid childView;
     TestViewServiceBase service = new TestViewServiceBase();
     ((TestViewLocator)service.ViewLocator).AllowCaching = true;
     ITestViewServiceBase iService = service;
     Interactivity.Interaction.GetBehaviors(parentView).Add(service);
     Window.Content = parentView;
     EnqueueShowWindow();
     EnqueueCallback(() => {
         iService.CreateChildView("testViewWithViewModel", null, parentVM.TestParameter, parentVM);
     });
     EnqueueWindowUpdateLayout();
     EnqueueCallback(() => {
         parentVM.TestParameter = "parameter2";
         iService.CreateChildView("testViewWithViewModel", null, parentVM.TestParameter, parentVM);
     });
     EnqueueWindowUpdateLayout();
     EnqueueCallback(() => {
         childView = parentView.Children[0] as Grid;
         Assert.AreSame(parentVM, ((ISupportParentViewModel)childView.DataContext).ParentViewModel);
         Assert.AreEqual(parentVM.TestParameter, ((ISupportParameter)childView.DataContext).Parameter);
     });
     EnqueueTestComplete();
 }
예제 #4
0
 void Init_ViewModelExtensionsWithService_TestView(out ITestViewServiceBase service, out ChildViewModel childVM, out ParentViewModel parentVM) {
     parentVM = new ParentViewModel() { TestParameter = "parameter" };
     childVM = new ChildViewModel();
     Grid parentView = new Grid();
     service = new TestViewServiceBase();
     Interactivity.Interaction.GetBehaviors(parentView).Add((TestViewServiceBase)service);
     Window.Content = parentView;
 }