Search code examples
wpfprismribbon

How to pass parameter from View through Ribbon in WPF/Prism?


I did successfully place a RibbonControl into my shell-view (I'm using PRISM) and I'm also able to navigate to a different view when a Ribbon control has been clicked.

Now, I'm stuck with the following problem: how can I pass a parameter from one view to the other? I know how to do it via CommandParameter however, the problem is that I'm in the shell view model.

To be more explicit: e.g. on 1st view user selects a row from listview (containing record ID). Now, I want to click on a RibbonButton and open a 2nd view with the parameter from view 1.

Could someone point me to the right direction?

Thank you so much!

N.


Solution

  • Use IRegionManager.RequestNavigate to navigate, and then have you ViewModels implement INavigationAware. Read the docs here:

    https://github.com/PrismLibrary/Prism/blob/master/Documentation/WPF/60-Navigation.md