public void SetupFormFields( DynForm f ) { // This is where we "design" the form to be displayed. // Most follow this format: f.AddSomething( "Label", "PropertyName" ) // It's usually a good thing to begin by adding a header f.AddLayoutHeader( "Person Details" ); // If we are creating a new person we let the user set the SSN, but when editing an // existing persons we just display the SSN in a label, since you are not allowed // to change your SSN. if( this.SSN == "" ) f.AddLayoutMaskedTextBox( "Social Security Number", "SSN", "000-00-0000" ); // See MSDN for info on setting up the MaskedTextBox validation pattern else f.AddLayoutLabel( "Social Security Number", "SSN" ); // Name is a simple text input box f.AddLayoutTextBox( "Full name", "Name", 32 ); // Dates can be set using a date picker f.AddLayoutDatePicker( "Date of bith", "Birthday" ); // New header. Separate the form into logical section for improved usability f.AddLayoutHeader( "Trivia" ); // The dropdown list needs some data to work with. This data can be created on the fly, like here, or obtained from any other data source you with var colors = new List<DynFormList>(); colors.Add( new DynFormList( null, "Not set" ) ); colors.Add( new DynFormList("Red","Red like roses") ); colors.Add( new DynFormList( "Green", "Green like a summer field" ) ); colors.Add( new DynFormList( "Blue", "Blue like the deep ocean" ) ); f.AddLayoutDropdown("Favourite colour", "FavoriteColor", colors); // Number spinner. The last arguments allows you to set number of decimals and min/max values f.AddLayoutNumberBox( "Lucky Number", "LuckyNumber", 0, 1, 16 ); // A simple checkbox working against a boolean f.AddLayoutCheckbox( "Likes pizza?", "LikesPizza" ); // The listbox allows you to select items from a list. // Again, we use the DynFormList to provide DynForm with source data (allPets) var allPets = new List<DynFormList>(); allPets.Add( new DynFormList( "DogID", "Dog" ) ); allPets.Add( new DynFormList( "CatID", "Cat" ) ); allPets.Add( new DynFormList( "RatID", "Rat" ) ); allPets.Add( new DynFormList( "LizardID", "Lizard" ) ); allPets.Add( new DynFormList( "BirdID", "Bird" ) ); allPets.Add( new DynFormList( "FishID", "Fish" ) ); allPets.Add( new DynFormList( "RabbitID", "Rabbit" ) ); f.AddLayoutListbox( "Pets", "Pets", allPets, "Add a pet" ); }