You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a practical need. In the project module development, I need to use the RegisterViewWithRegion method in Prism. However, the current method cannot let me know that my view has been successfully initialized and navigated, and I cannot pass parameters to the current page after the interface is initialized. I found that the RequestNavigate method can be passed, but there is a difference between RequestNavigate and RegisterViewWithRegion. RequestNavigate can only be used and pass parameters after the view is constructed. RegisterViewWithRegion can only initialize and navigate to the current view, and cannot pass parameters or trigger OnNavigatedTo. I don’t know if there is a method in the framework that can trigger a method similar to OnNavigatedTo after calling the RegisterViewWithRegion method to complete a basic page initialization loading method. This method is used to load data on the server.
Context
I now have a temporary solution, which is to call getContentDelegate in RegisterViewWithRegion to complete the method of getting data from the server.
public void OnInitialized(IContainerProvider containerProvider)
{
var Region = containerProvider.Resolve<IRegionManager>();
Region.RegisterViewWithRegion(SystemResource.Root, provider =>
{
var main = provider.Resolve<Main>();
if (main.DataContext is MainViewModel vm) vm.Init();
return main;
});
}
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<Main, MainViewModel>(nameof(Main));
}
Is there any other more elegant solution? If not, can the framework support adding the actual functional requirements I proposed to expand the robustness of the current framework?
The text was updated successfully, but these errors were encountered:
Description
I have a practical need. In the project module development, I need to use the RegisterViewWithRegion method in Prism. However, the current method cannot let me know that my view has been successfully initialized and navigated, and I cannot pass parameters to the current page after the interface is initialized. I found that the RequestNavigate method can be passed, but there is a difference between RequestNavigate and RegisterViewWithRegion. RequestNavigate can only be used and pass parameters after the view is constructed. RegisterViewWithRegion can only initialize and navigate to the current view, and cannot pass parameters or trigger OnNavigatedTo. I don’t know if there is a method in the framework that can trigger a method similar to OnNavigatedTo after calling the RegisterViewWithRegion method to complete a basic page initialization loading method. This method is used to load data on the server.
Context
I now have a temporary solution, which is to call getContentDelegate in RegisterViewWithRegion to complete the method of getting data from the server.
Is there any other more elegant solution? If not, can the framework support adding the actual functional requirements I proposed to expand the robustness of the current framework?
The text was updated successfully, but these errors were encountered: