0
votes

Is there a way in which I can access my parent shell's variables from each of the regions while using WPF Prism? I would like to have a unique identifier for a shell, while I'm creating many shells.

So by the end of it, I need my objects from the regions/views to be able to access one variable that's common across that shell.

1
Please clarify what you mean by "while I'm creating many shells". The Shell is intended to be the MainWindow of the WPF application, so there can really only be one "shell" per process/application instance. Do you mean you're starting multiple instances of the same application?Brian S

1 Answers

0
votes

Put the identifier in the region context of the regions defined in the shell. You can implement some simple behaviours to allow the views/view models to access the context variable easily, as the default region context behaviour is quite flawed.

However, I'm wondering why your views need to be aware of the shell they are in, as this runs contrary to Prism design principles.

I do hope you are not using the ID to filter events from the event aggregator that came from other shell windows...