I got a user control that is general for a range of file types. This usercontrol needs to hold and display another usercontrol that is specific for each file. So i like a type of strategy pattern usercontrol selection based on the file type. So if a user opens file A the child usercontrol will be of a type ucA and if he opens file type B it will be of type ucB
What would be the best approch for this.
Should the parent usercontrol hold a ContentPresenter where i at runtime can insert the correct child usercontrol based on file type? Or is there some better way to go about it.
or simply run some codebehind that says or similar to that effect.
parentUCPanel.Children.Add(Factory.GetUC(filetype));
Forgot to add that i expect the child usercontrols to have a common basetype with some dependency properties to bind to the viewmodel of the parent usercontrol.
Thank you very much for any help.
Have a look if DataTemplateSelector will be of use.