I have string property and Fill it with This Code :
prop1= MyCustomPanle.GetType().ToString();
I use prop1 to keep type of Controls(wpf base control’s and custom control’s) .I keep this property and want to create type base on value this property. Something like This:
Type ControlType=Type.Gettype(prop1);
But this Type.GetType() work only for variable type like int, string, etc.
How convert string to control type?
You need to pass in the full
AssemblyQualifiedNameintoGetType().You can get this from calling
GetType().AssemblyQualifiedNameon an existing instance of the type you want.e.g.
myControlTypeNameabove ends up as:But if you want it to be version neutral I beleive it can be shorted to the below and still work: