This question is related to following thread. Prism RegionAdapter - Removing then Adding View
My post to this thread was deleted my admin, saying it was answered and I need to start new thread. Please let me know if any of you have solved this issue.
My deleted post was... How did you manage to get rid of "Specified element is already the logical child of another element. Disconnect it first." error with closing event. I tried the same thing, on closing I remove the dockablecontent from the documentpane. But it doesn't help I keep getting this error. Once I remove the view, and then later try to add it again the same way you are adding, I get this error.
Please help me, I am not sure what am I missing. I have wasted so much of time trying to get around it but no luck yet.
Here is the code I am using:
<ad:DockableContent ...
x:Name="viewRoot"
IsCloseable="True" HideOnClose="False"
Title="{Binding Title}">
<ContentControl Grid.Row="1" Content="{Binding View}"/>
</Grid>
</ad:DockableContent>
It gets used inside this:
<ad:DockingManager x:Name="DockingManagerControl" Grid.Column="1">
<ad:ResizingPanel x:Name="MainResizingPanel" ResizeWidth="*" ResizeHeight="*" Orientation="Horizontal">
<ad:DockablePane ad:ResizingPanel.ResizeWidth="0.25*" prism:RegionManager.RegionName="ProjectBrowserRegion"/>
<ad:ResizingPanel x:Name="PespectiveResizingPanel" ResizeWidth="0.75*" ResizeHeight="*" Orientation="Horizontal">
<ad:DocumentPane x:Name="DockablePaneControl"/>
</ad:ResizingPanel>
</ad:ResizingPanel>
</ad:DockingManager>
View content bindings are UI element which comes from separate dlls, So I don't have them as View/ViewModel pair. So I can't use ContentTemplate+DataContext way here. Things load nicely, but use can select/deselect these views. So if a view has been opens the view selection dialog again, then I clear all views (I remove it from DockablePaneControl Items.Clear()), and add the selected views again (DockablePaneControl Items.Add()), then I get this error.