Hi,
according to your mvvm samples I've created a test application using the docking control. The application contains a few viewmodels that inherits from a class called DocumentWindowViewModelBase (not of further interest).
The application also contains a DeferrableObserableCollection called _documentWindows and a property GetDocumentWindows, that is the binding source for the DockSite:
Private _documentWindows As New DeferrableObservableCollection(Of DocumentWindowViewModelBase)()
Public ReadOnly Property GetDocumentWindows() As IList(Of DocumentWindowViewModelBase)
Get
Return _documentWindows
End Get
End Property
<docking:DockSite x:Name="dockSite"
DocumentItemContainerStyle="{StaticResource DocumentWindowStyle}"
DocumentItemsSource="{Binding GetDocumentWindows}"
WindowsClosing="{dxmvvmb:DXEvent Handler='OnWindowsClosing (@args)'}">
...
</docking:DockSite>
(I'm using the DevExpress MVVM Framework as you can see in the line WindowsClosing).
In the method OnWindowsClosing, which will be accomplished when a docking window is closed, I want to determine the underlying viewmodel of the closed window. For instance, I have three viewmodels: "vm1", "vm2" and "vm3". Adding them to _documentWindows, I see three DocumentWindows: "Window A" based on "vm1, "Window B" based on "vm2" and "Window C" based on "vm3".
Imagine, the user closes "Window C" (which mustn't be the active window) via the X - Icon. How can I access the underlying viewmodel "vm3"? I can't see a connection between DocumentWindow and the viewmodel.
Thanks in advance
Michael