In this particular situation I agree with you, in the fact that an event should be published to notify that the customer was selected (in
fact in a demo application I have helped creating recently
we did it like that).
Actually what we did was creating a
DelegateCommand with an attached behavior for the
SelectionChanged event of a WPF DataGrid. Each time we selected a new customer, the command would be fired. The code for that command simply fired an event through event aggregator (passing the Customer as payload), which was handled by another view’s
In your scenario, the event could be handled by a “module controller” in the module that has the
CustomerDetails view (by a “module controller” I mean something that knows things about the entire module, not just a single view like a Presenter/ViewModel).
This controller could use a service (I do not know how your
CustomerUIService is implemented), or simply a list of the customer’s whose details are already being shown. Then, if the customer is in that list, it could perform the logic to make it visible in the details region, and else create a
new view and show it.
Although I do not know your application scenario, if you only show one customer details view at the same time (using a
SingleActiveRegion), you could have a single instance of the
CustomerDetails view, and just change the data context based on the selected customer. This is not completely related with your question, but it might save you unnecessary view creation.
Please let me know if this helps.