Create WPF controls by Name

psybert

New member
Joined
Jul 7, 2008
Messages
1
Programming Experience
Beginner
I've been struggling for the better half of two days trying to do this.
I have a project with a base Window, and then a series of controls which I want to add at runtime based on a string from a file.

I'm reading a string say "controlA" and i want to create an instance of the user control with the class name "controlA" and then add it to a base window. I want to have a constructor, but for now I would just like to see it work without.

I've been playing around with Reflection.Assembly, System.Activator.createInstance, Invokemember, CreateObject, and a few others. I can't seem to get it to work. Any help would be greatly appreciated. Thanks!
 
Back
Top