Hello!
I have a XamDockManager with a DocumentContentHost. I've implemented a UserControl with some custom DependencyProperties. At runtime I add the UserControl in a ContentPane.
Now I got the problem if I switch the Tab Doc Page, all my custom Properties are reset to the inital default values (go to the next page and switch back).
It seems this is only the case in the main control (UserControl). All child controls keep the current state.
How can I prevent the property reset on pane activation?
thx benni
The ContentPane doesn't do anything with its Content other than to host it in a ContentPresenter in its template as any ContentControl derived element does. Since you mention that the problem only happens when switching tabs I can only guess that something is changing the state of your object in response to an Unloaded event as the TabGroupPane which hosts the tabs is a derived WPF TabControl and the WPF TabControl only keeps the content of the selected tab in the visual tree and therefore when you switch tabs the unloaded event is raised. If this is not the issue and you are still experiencing this problem please provide a sample project and we can investigate what is the cause of the problem you are seeing.
"therefore when you switch tabs the unloaded event is raised."
Is this intended? I really do not want to manage the state of inactive tabs. In the interest of user experience I also do not want to have to reload data into visual elements when a tab is activated. This slows down the interface for particularly data intensive views.
The Unloaded event is raised by the WPF framework when an element leaves the visual tree and the WPF tab control only keeps the visuals of the selected tab in the visual tree. How that will affect the visuals within those elements will depend on the element in question.