Generating Form Controls from XML

Feb 9 2005 3:52 PM
I've been drooling over Avalon since I saw a demo of it, and wanted to see if anyone else was having trouble passing the time till Longhorn shows up. I've written a class library that reads in a xml file, with in-line schema info, and creates controls on a form based on elements in the file. It's pretty cool, I can update the xml file and change what controls are loaded, what property values each control has, and where they are located on the form. I haven't added any events, since it was hard enough just to get things working. I like C#, but I come from a Perl background and the type system in .NET is slightly annoying. To get a text field in an xml file typed to a certain control, I have to do the following just to get a Type: Type t = Type.GetType("System.Windows.Forms." + + ",System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); Then to get an instance of the above Type: ConstructorInfo c = t.GetConstructor(System.Type.EmptyTypes); object o = c.Invoke(null); Now, it's Typed, but as an object, which doesn't contain anything useful. To use anything from the thing, I have to create PropertyInfo and MethodInfo objects, and then do all kinds of stuff just to get things set and use the thing. Makes me sad just thinking about it. It would be so much easier if they just let me sling crap around and figure it all out when I get a nice Exception.:) Anyways, let me know if you can't wait for Avalon!