)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create DateTimePicker in GridControl?

Platform: WinForms |
Control: GridControl |
Published Date: April 29, 2016 |
Last Revised Date: May 28, 2019

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

C#

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; 
        }
    }
}

VB

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

Sample:

C#: Right-to-left DateTimePicker

VB: Right-to-left DateTimePicker

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon