Is there some open source code already written out there somewhere that will accept a class with properties and validation attributes, and output a Windows form with controls that correspond to those properties?
Examples:
public bool IsRed { get; set; }
produces a checkbox with an Is Red?
label.
public int NumberOfDays { get; set; }
produces a text box with a label called Number of Days
and restricts input to numeric characters only.
[Required]
public Color Color { get; set; }
where Color is an enum of the form
public enum Color
{
Red,
Green,
Blue
}
produces a combo box with the list populated with Red
Green
and Blue
, and makes it required.
Ideally, the generated code includes a method that accepts an instance of my class and prepopulates the controls in the winform with the values in the properties of my instance. Correspondingly, another method saves the existing values in the controls to an instance of my class.
Is there something like that available?
Please note: I am not looking for:
- An ORM or DAL
- A generalized tool like CodeSmith, unless it's free and open-source
- WPF or ASP.NET code, it needs to be Winforms
- NetTiers or any similar type of complete application framework, unless I can parse out the small part of it that applies specifically to this scenario.