The DateEditor can be used to edit the content of cells which have a DateTime datatype.
By default, the DateEditor will be created as the CellEditorManager for all columns in the grid which have a DateTime datatype.
If a CellEditorManager other than the DateEditor is desired by default for columns which have a DateTime datatype, the GridControl's CellEditorManagerMapping property can be modified. For example:
VB.NET | Copy Code |
---|---|
GridControl1.CellEditorManagerMapping( GetType( DateTime) ) = New CustomDateEditor() |
C# | Copy Code |
---|---|
gridControl1.CellEditorManagerMapping[ typeof( DateTime ) ] = new CustomDateEditor(); |
If a different CellEditorManager is required for only one column or cell, the CellEditorManager property of the specific column or cell can be set rather than changing the default CellEditorManager that is created for all DateTime columns via the CellEditorManagerMapping property.
VB.NET | Copy Code |
---|---|
GridControl1.Columns( "Order_Date" ).CellEditorManager = New CustomDateEditor() |
C# | Copy Code |
---|---|
gridControl1.Columns[ "Order_Date" ].CellEditorManager = new CustomDateEditor(); |
The underlying control wrapped by the DateEditor control is the WinDatePicker control and is accessible through the TemplateControl property. All settings relating to the underlying control must be accessed via the TemplateControl property. Note that if a cloned instance of the TemplateControl is used to edit (refer to the CreateControlMode property and CreateControl method), the actual control that is used will be a clone of the TemplateControl and not the TemplateControl itself. In this case, the ActivatingControl event can be used to modify the cloned instances.
More information regarding the WinDatePicker control can be found in the WinDatePicker control topic.