Hi,
I'm trying to re-create content panes from code as part of different default views requirement. But I'm encountering an error whenever I unpin a content pane and trying to add the same to a split pane in another view.
Error:
Specified element is already the logical child of another element. Disconnect it first.
I tried to disconnect it in various ways unsuccessfully.
contentPane.ExecuteCommand(ContentPaneCommands.TogglePinnedState);
when I use the below code. I get a different error: Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead.
((UnpinnedTabArea)contentPane.Parent).Items.Clear();
Could you please help me resolving the issue asap.
Thanks,