-
Notifications
You must be signed in to change notification settings - Fork 42
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
RegisterViewWithRegion enhancements #210
Comments
@Coolkeke If all you really need to do is call the Init() function on your ViewModel when your View loads then you can accomplish that by using an EventTriggerBehavior on your View and a DelegateCommand on your ViewModel. IE:
Just remember that this Event may get called more than once on the same ViewModel! |
Loaded and RegisterViewWithRegion are substantially different and cannot be mixed |
@Coolkeke Strange, I don't seem to particularly have a problem using the XAML Loaded event on a View that was registered using RegisterViewWithRegion. I wonder what is so different about my code from yours? Perhaps you could simply iterate on what you already have and make it an extension method, such as:
|
@Coolkeke I assume that you already tried calling Init() from your ctor and that you have already tried using IActiveAware (it does not always work out of the box)? I feel like their must be a more straight forward way to accomplish your requirement. It is driving me nuts! |
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: