I am currently using Avalondock 2.0 with the mvvm pattern.
It seems that when you remove an element present in your datasource, the DockManager does not remove the element from the root panel.
Ex:
This is how I bind my sources.
ltxcad:DockingManager x:Name=quotdockManagerquot
DocumentsSource=quot{Binding Workspace.Tools}quot
AnchorablesSource=quot{Binding Workspace.Informations}quot
ActiveContent=quot{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}quot gt
-Tools amp Informations are ObservableCollectionltTgt
How my content is bind
ltSelector:PanesTemplateSelectorgt
ltSelector:PanesTemplateSelector.ToolViewTemplategt
ltDataTemplategt
ltGroupBox Content=quot{Binding UserControl, UpdateSourceTrigger=PropertyChanged}quot BorderThickness=quot0quot /gt
lt/DataTemplategt
lt/Selector:PanesTemplateSelector.ToolViewTemplategt
Then how I bind my CloseCommand.
ltSelector:PanesStyleSelectorgt
pixipix[CodePlex]
Hello,
I am currently using Avalondock 2.0 with the mvvm pattern. It seems that when you remove an element present in your datasource, the DockManager does not remove the element from the root panel.
Ex: This is how I bind my sources. ltxcad:DockingManager x:Name=quotdockManagerquot DocumentsSource=quot{Binding Workspace.Tools}quot AnchorablesSource=quot{Binding Workspace.Informations}quot ActiveContent=quot{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}quot gt -Tools amp Informations are ObservableCollectionltTgt
How my content is bind ltSelector:PanesTemplateSelectorgt ltSelector:PanesTemplateSelector.ToolViewTemplategt ltDataTemplategt ltGroupBox Content=quot{Binding UserControl, UpdateSourceTrigger=PropertyChanged}quot BorderThickness=quot0quot /gt lt/DataTemplategt lt/Selector:PanesTemplateSelector.ToolViewTemplategt Then how I bind my CloseCommand. ltSelector:PanesStyleSelectorgt
Now when I click on the 'X' button, I will remove my tool panel from my ObservableCollectionltTgt like this.
internal void Close(PaneViewModel fileToClose) { if (fileToClose.IsDirty) { /// }
I tried something I put a timer on my workingScreen and I could noticed that:
Event if the WorkingScreen is removed from the OBSCltTgt the timer is still working. The UserControl present in the OBSCltTgt is never collected.
Is there a way to ask to the DockManager to remove the Child related the ClosingScreen when I remove it from the ObservableCollectionltgt?
I do not have access to the DockPanelRoot, I am working in MVVM.
Regards,