-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prism.Autofac RegisterTypeForNavigation issue #1120
Comments
This is very strange. Just so you know This will work: Maybe someone more familiar with Autofac can help you out. For now, just use the type name, because Autofac seems to prefer that. |
Actually, I dug a little deeper and found that the other containers do not properly implement the necessary classes to function properly. What Autofac is missing is the AutofacRegionNavigationContentLoader. You can see Unity's here: https://github.com/PrismLibrary/Prism/blob/master/Source/Wpf/Prism.Unity.Wpf/Regions/UnityRegionNavigationContentLoader.cs If you create this class and implement the |
It would be great if someone from the Autofac community could implement this class using the Unity class as a guide and submit a PR. |
Thanks for investigating Brian, much appreciated. Unfortunately the view names are already defined and I can't change them so I'll follow your fix suggestion above. I'll also raise the issue with the autofac devs. Thanks again. |
I'm not familiar with Autofac but I think this should work
Then register it in the bootstrapper:
You'll want to have someone that actually knows Autofac to double check that. |
Thanks Brian, I attempted it myself and it's exactly the same as yours. I raised the issue with the Autofac devs but haven't had a response yet, although I suspect the reason the Autofac content loader doesn't exist is due to this stackoverflow response... |
this work in the demo if you switch to
|
Unfortunately, it doesn't work unless you add the custom content loader that I provided in this thread. Also, Autofac is switching to an immutable container. Which means you will no longer be able to update the container using Update() |
fixed |
While this has been marked as fixed / closed. I appear to be having the same issue in Prism.Ninject. Would I be correct in assuming it's down to the same root cause? It seems navigation called OnNavigatedTo and OnNavigatedFrom fine, but never calls any of my IsNavigationTarget. |
It is probably related to the same issue. Whoever implemented the Ninject support, didn't provide the necessary content loader. Just follow the same pattern discussed in this thread and see if it works for you. |
not just autofac, i'm using DryIoc, this issue still exist. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Navigation doesn't appear to be working correctly if I specify a 'name' when using ContainerBuilder.RegisterTypeForNavigation< TView >(name)
I can correctly navigate to the view the first time but subsequent navigation attempts do not call INavigationAware.IsNavigationTarget()
The issue is reproducable by modifying the NavigationParticipation sample solution to use Autofac with named views, e.g.:
builder.RegisterTypeForNavigation< ViewA >("ThisIsViewA");
Calling regionManager.RequestNavigate("ContentRegion", "ThisIsViewA") for the second time does not call INavigationAware.IsNavigationTarget() on the ViewA viewmodel. I tried this with Unity and it works as expected.
The text was updated successfully, but these errors were encountered: