Hierarchical navigation with conductor and event aggregator

This application is for my application. Please note that I have a conductor as another conductor. And I have an IHandle for each explorer to receive a message from it child.The message type is the same as I use the message only for navigation. My problem is that I pass the ShellView EventAggregator to these children.

What about the NewConnectionView EventAggregator? Since I use its EventAggregator to navigate the ShellView. And for him, children float on it ActiveItem.

How to separate these 2 EventAggregators in one ViewModel.

ShellView and NewConnectionView ==> Conductor.Collection.OneActive

+----------------------------------+ | ShellView |_|[]|x| +----------------------------------+ | +------------------------------+ | | | | | | | | | | | | | | | ActiveItem | | | | | | | | | | | | | | | +------------------------------+ | +----------------------------------+ / \ / \ / \ / \ / \ / \ / \ +----------------------------------+ +----------------------------------+ | NewConnectionView |_|[]|x| | ConnectionListView |_|[]|x| +----------------------------------+ +----------------------------------+ | +------------------------------+ | | TextBlock | | | ComboBox | V | | | +----------------------+ +-----+ | | +------------------------------+ | | | | | Btn | | | +------------------------------+ | | | | +-----+ | | | | | | | | +-----+ | | | | | | | | | Btn | | | | | | | | DataGrid | +-----+ | | | ActiveItem | | | | | +-----+ | | | | | | | | | Btn | | | | | | | | | +-----+ | | | | | | | | | | +------------------------------+ | | +----------------------+ | +----------------------------------+ +----------------------------------+ / \ / \ / \ / \ / \ / \ / \ +----------------------------------+ +----------------------------------+ | FileConnectionView |_|[]|x| | DatabaseConnectionView |_|[]|x| +----------------------------------+ +----------------------------------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +----------------------------------+ +----------------------------------+ 

Currently, my approach uses NewConnectionShellView (Screen) as the parent of the NewConnectionView (Explorer) to split the EventAggregator. But the problem is that I cannot get the DisplayName for children of NewConnectionView to appear in the main window (ShellView).

Please note that I do not use MEF. Is there any workaround?

  +----------------------------------+ | ShellView |_|[]|x| +----------------------------------+ | +------------------------------+ | | | | | | | | | | | | | | | ActiveItem | | | | | | | | | | | | | | | +------------------------------+ | +----------------------------------+ / \ / \ / \ / \ / \ / \ / \ +----------------------------------+ +----------------------------------+ | NewConnectionShellView |_|[]|x| | ConnectionListView |_|[]|x| +----------------------------------+ +----------------------------------+ | +------------------------------+ | | TextBlock | | | | | | +----------------------+ +-----+ | | | | | | | | | Btn | | | | | | | | | +-----+ | | | | | | | | +-----+ | | | | | | | | | Btn | | | | | | | | DataGrid | +-----+ | | | ActiveItem | | | | | +-----+ | | | | | | | | | Btn | | | | | | | | | +-----+ | | | | | | | | | | +------------------------------+ | | +----------------------+ | +----------------------------------+ +----------------------------------+ | | | | | | | | V +----------------------------------+ | NewConnectionView |_|[]|x| +----------------------------------+ | +------------------------------+ | | | ComboBox | V | | | +------------------------------+ | | +------------------------------+ | | | | | | | | | | | | | | | ActiveItem | | | | | | | | | | | | | | | +------------------------------+ | +----------------------------------+ / \ / \ / \ / \ / \ / \ / \ +----------------------------------+ +----------------------------------+ | FileConnectionView |_|[]|x| | DatabaseConnectionView |_|[]|x| +----------------------------------+ +----------------------------------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +----------------------------------+ +----------------------------------+ 
+4
source share
1 answer

It looks like you want to use one instance of an event aggregator to exchange a shell / plugin and one instance for each plugin to exchange data between views. I would recommend using both an IoC container and registering a shell event aggregator as plain, and then using factories that have a container reference to allow instances of your view models.

You can have one message type that changes the display name and is published in an instance of the shell event aggregator, and one message type that changes the current active element and is used in all instances of the event aggregator.

0
source

All Articles