Set first day of week on griddatetimecolumn dropdown

I have an sfdatagrid with a griddatetimecolumn.

For the dropdown calendar in that column, how can I change the first day of the week to Monday instead of Sunday?


Thanks,

Rod


3 Replies 1 reply marked as answer

DM Dhanasekar Mohanraj Syncfusion Team April 15, 2022 01:00 PM UTC

Hi Rod Schmitzer,

You can achieve your requirement by using below code snippet,

this.sfDataGrid1.CellRenderers["DateTime"] = new CustomDateTimeRenderer(this.sfDataGrid1);

public class CustomDateTimeRenderer : GridDateTimeCellRenderer

{

    SfDataGrid DataGrid { get; set; }

    public CustomDateTimeRenderer(SfDataGrid dataGrid)

    {

        this.DataGrid = dataGrid;

    }

 

    protected override void OnInitializeEditElement(DataColumnBase column, RowColumnIndex rowColumnIndex, SfDateTimeEdit uiElement)

    {

        uiElement.MonthCalendar.FirstDayOfWeek = DayOfWeek.Monday;

        base.OnInitializeEditElement(column, rowColumnIndex, uiElement);

    }

 

}


We had prepared the sample for your requirement. Please check this and revert us if you need further assistance.

Regards,
Dhanasekar M.


Attachment: Column_Types_36718f59.zip

Marked as answer

RS Rod Schmitzer April 18, 2022 10:41 PM UTC

Thank you, this works exactly how I need it to.



DM Dhanasekar Mohanraj Syncfusion Team April 19, 2022 01:54 PM UTC

Hi Rod Schmitzer,



We are glad to know the provided solution satisfied your requirement. Please let us know if you have any further queries on this.


Regards,

Dhanasekar M.


Loader.
Up arrow icon