I want a clean solution to a little problem i have : i have a standard main page view and its view model, inside the view i display a user control (Dossier) with its view model (DossierViewModel).
To dynamically instantiate my view from the main viewmodel i used a DataTemplate and a ContentControl :
<Window.Resources>
<DataTemplate DataType="{x:Type vm:DossierViewModel}">
<local:Dossier />
</DataTemplate>
</Window.Resources>
...
<ContentControl x:Name="ContentControl" Content="{Binding SampleDossier}"/>
No problem here.
But, i have a main function which parses everything in my window in order to persist certain visual elements states. And when i use the TreeHelper to get the children of my ContentControl, i get only one, the view model DossierViewModel. Whereas what i want is the visual elements of my usercontrol binded on this view model.
How can i jump that gap ?