0

I'm working with Prism and I have a view which will manage some variable entity objects.

E.g.: Now I'm managing a User, but later I would manage a Customer using the same view (I already have the solution to achieve it ... link 1 - link 2).

This object (or the object type) to be managed must be declared and passed by me.

In a common way, I could pass the object type through a parameter on the constructor, but as I'm using Prism and I don't directly use the constructor of the Views or ViewModels.

Here's a snippet of how I currently "invoke" my views:

var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
var viewUri = new Uri("MyGenericView", UriKind.Relative);
regionManager.RequestNavigate("AreaTrabalho", viewUri);

The problem is: I can't pass a parameter. Is there a way of passing that parameter or an alternative way of doing this (without a kind of ugly hack)?

Community
  • 1
  • 1
Diego Stiehl
  • 403
  • 8
  • 25

1 Answers1

0

You can implement INavigationAware on your VM's and pass parameters inside query string in your regionManager.RequestNavigate call

katit
  • 17,375
  • 35
  • 128
  • 256
  • Implementing `INavigationAware` on my ViewModels didn't work for me. It only worked when implemented on the Views. And as far as I know, I can only pass `string` through a query string. – Diego Stiehl Jan 25 '12 at 11:49