Articles in this section
Category / Section

How to create DateTimePicker in GridControl?

1 min read

To add a DateTimePicker cell in grid and its dropdown button will be aligned in RightToLeft order, can be handled by using CurrentCellActivating event.


this.gridControl1.CurrentCellActivating += gridControl1_CurrentCellActivating;
private void gridControl1_CurrentCellActivating(object sender, GridCurrentCellActivatingEventArgs e)
    GridStyleInfo style = this.gridControl1.GetViewStyleInfo(e.RowIndex, e.ColIndex);
    if (style.CellType == "DateTimePicker")
        foreach (Control control in this.gridControl1.Controls)
            if (control is MyDateTimePicker)
                (control as MyDateTimePicker).RightToLeft = System.Windows.Forms.RightToLeft.Yes; 


AddHandler Me.gridControl1.CurrentCellActivating, AddressOf gridControl1_CurrentCellActivating
private void gridControl1_CurrentCellActivating(Object sender, GridCurrentCellActivatingEventArgs e)
 Dim style As GridStyleInfo = Me.gridControl1.GetViewStyleInfo(e.RowIndex, e.ColIndex)
 If style.CellType Is "DateTimePicker" Then
  For Each control As Control In Me.gridControl1.Controls
   If TypeOf control Is MyDateTimePicker Then
    TryCast(control, MyDateTimePicker).RightToLeft = System.Windows.Forms.RightToLeft.Yes 'Assign the cell's RightToLeft here
   End If
  Next control
 End If



Showing DateTimePicker in GridControl


C#: Right-to-left DateTimePicker

VB: Right-to-left DateTimePicker


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment