這是我的應用程序架構。請注意,我有導體作爲另一位指揮的孩子。我有IHandle讓每個售票員從它的孩子那裏接收消息。消息類型與我用於導航的消息相同。我的問題是我將ShellView的EventAggregator傳遞給它的子節點。帶導體和事件聚合器的分層導航
NewConnectionView的EventAggregator怎麼樣?因爲我使用它的EventAggregator在ShellView上進行導航。因爲它是兒童導航它的ActiveItem。
如何在一個ViewModel中分離這2個EventAggregators。
ShellView & NewConnectionView ==> Conductor.Collection.OneActive
+----------------------------------+
| ShellView |_|[]|x|
+----------------------------------+
| +------------------------------+ |
| | | |
| | | |
| | | |
| | ActiveItem | |
| | | |
| | | |
| | | |
| +------------------------------+ |
+----------------------------------+
/ \
/ \
/ \
/ \
/ \
/ \
/ \
+----------------------------------+ +----------------------------------+
| NewConnectionView |_|[]|x| | ConnectionListView |_|[]|x|
+----------------------------------+ +----------------------------------+
| +------------------------------+ | | TextBlock |
| | ComboBox | V | | | +----------------------+ +-----+ |
| +------------------------------+ | | | | | Btn | |
| +------------------------------+ | | | | +-----+ |
| | | | | | | +-----+ |
| | | | | | | | Btn | |
| | | | | | DataGrid | +-----+ |
| | ActiveItem | | | | | +-----+ |
| | | | | | | | Btn | |
| | | | | | | +-----+ |
| | | | | | | |
| +------------------------------+ | | +----------------------+ |
+----------------------------------+ +----------------------------------+
/ \
/ \
/ \
/ \
/ \
/ \
/ \
+----------------------------------+ +----------------------------------+
| FileConnectionView |_|[]|x| | DatabaseConnectionView |_|[]|x|
+----------------------------------+ +----------------------------------+
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
+----------------------------------+ +----------------------------------+
目前,我的方法是使用NewConnectionShellView(屏幕)作爲NewConnectionView的(指揮)父母的EventAggregator分開。但問題是,我無法將NewConnectionView的子項的DisplayName顯示到我的主窗口(ShellView)中。
請注意,我沒有使用MEF。有沒有解決我的問題的方法?
+----------------------------------+
| ShellView |_|[]|x|
+----------------------------------+
| +------------------------------+ |
| | | |
| | | |
| | | |
| | ActiveItem | |
| | | |
| | | |
| | | |
| +------------------------------+ |
+----------------------------------+
/ \
/ \
/ \
/ \
/ \
/ \
/ \
+----------------------------------+ +----------------------------------+
| NewConnectionShellView |_|[]|x| | ConnectionListView |_|[]|x|
+----------------------------------+ +----------------------------------+
| +------------------------------+ | | TextBlock |
| | | | | +----------------------+ +-----+ |
| | | | | | | | Btn | |
| | | | | | | +-----+ |
| | | | | | | +-----+ |
| | | | | | | | Btn | |
| | | | | | DataGrid | +-----+ |
| | ActiveItem | | | | | +-----+ |
| | | | | | | | Btn | |
| | | | | | | +-----+ |
| | | | | | | |
| +------------------------------+ | | +----------------------+ |
+----------------------------------+ +----------------------------------+
|
|
|
|
|
|
|
|
V
+----------------------------------+
| NewConnectionView |_|[]|x|
+----------------------------------+
| +------------------------------+ |
| | ComboBox | V | |
| +------------------------------+ |
| +------------------------------+ |
| | | |
| | | |
| | | |
| | ActiveItem | |
| | | |
| | | |
| | | |
| +------------------------------+ |
+----------------------------------+
/ \
/ \
/ \
/ \
/ \
/ \
/ \
+----------------------------------+ +----------------------------------+
| FileConnectionView |_|[]|x| | DatabaseConnectionView |_|[]|x|
+----------------------------------+ +----------------------------------+
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
+----------------------------------+ +----------------------------------+
對於ASCII藝術的+1 – juFo 2013-10-08 11:45:40