This class provides shared helper methods that the design-time host (IDE) can use to generate "dummy" information for a sample rendering of a complex control. Typically, this class is used with table controls, as maintaining a database connection in design mode would be too resource-intensive, and the data source provider may not even be available. Using the CreateDummyDataTable( ) method, a default table is created that uses no information from the actual data source. This table could be used before a control's DataSource property is set.
Visual Studio .NET can also use a minimum amount of information to help present a design-time rendering of data tables. The GetDataFields( ) and GetDataMembers( ) methods retrieve a basic amount of information about the structure of the data source, which is then used when a dummy table is created with CreateSampleDataTable( ). The GetDesignTimeDataSource( ) method adds sample rows into the specified data table control.
public sealed class DesignTimeData { // Public Static Fields public static readonly EventHandler DataBindingHandler; // =System.EventHandler// Public Static Methods public static DataTable CreateDummyDataTable( ); public static DataTable CreateSampleDataTable(System.Collections.IEnumerable referenceData); public static PropertyDescriptorCollection GetDataFields(System.Collections.IEnumerable dataSource); public static IEnumerable GetDataMember(System.ComponentModel.IListSource dataSource, string dataMember); public static string[ ] GetDataMembers(object dataSource); public static IEnumerable GetDesignTimeDataSource(System.Data.DataTable dataTable, int minimumRows); public static IEnumerable GetSelectedDataSource(System.ComponentModel.IComponent component, string dataSource, string dataMember); public static object GetSelectedDataSource(System.ComponentModel.IComponent component, string dataSource); }