Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Raised event of InteractionRequest becomes null

$
0
0
@BrianNoyes, Sorry for late reply...
I resolved this issue. The issue was that for user control I haven't assigned the viewModel explicitly and it was using the viewModel of it's parent view. So to resolved this issue, I have explicitly injected view model to the child user control.
So while registering my code was:

// Register ViewModel
this.container.RegisterType<IParentViewModel, ParentViewModel>("ParentviewModel", new ContainerControlledLifetimeManager());

// Register View
this.container.RegisterType<object, ParentView>("ParentView", new InjectionConstructor(new ResolvedParameter<IParentViewModel>("ParentViewModel")));
this.container.RegisterType<object, UserControl1View>("UserControl1View");
this.container.RegisterType<object, UserControl2View>("UserControl2View");
So in the above code I haven't explicitly injected the view model for UserControl1View and UserControl2View and it was using ParentViewModel.

To resolve this issue I have explicitly injected view Model as below and it works.

// Register View
this.container.RegisterType<object, ParentView>("ParentView", new InjectionConstructor(new ResolvedParameter<IParentViewModel>("ParentViewModel")));
this.container.RegisterType<object, UserControl1View>("UserControl1View", new InjectionConstructor(new ResolvedParameter<IParentViewModel>("ParentViewModel")));
this.container.RegisterType<object, UserControl2View>("UserControl2View", new InjectionConstructor(new ResolvedParameter<IParentViewModel>("ParentViewModel")));

So what's the issue with Raised event in PRISM popup if we don't explicitly inject view model.

Thanks,
Ayaz Shaikh

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>