Articles in this section

How to change the format of the Date Editor in .NET MAUI DataForm (SfDataForm)?

In the Syncfusion® .NET MAUI DataForm (SfDataForm), you can change the format of the Date Editor using the Format property. Follow the steps below to implement this.

C#:

In the behavior class, initiate the GenerateDataFormItem event handler to the OnGenerateDataFormItem event.

protected override void OnAttachedTo(SfDataForm dataForm)
{
   base.OnAttachedTo(dataForm);
   if (dataForm != null )
   {
       dataForm.ItemsSourceProvider = new ItemSourceProvider();
       dataForm.GenerateDataFormItem += OnGenerateDataFormItem;
   }
}

C#:

In the OnGenerateDataFormItem event by verify that the item is a DataFormDateItem and change the date format by setting the Format property to a custom format string.

private void OnGenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)
{
   if (e.DataFormItem!= null)
   {
       if (e.DataFormItem.FieldName == "EventDate" && e.DataFormItem is DataFormDateItem dateItem)
       {
           dateItem.Format = "dd, MMMM, yyyy";
       }
   }
}

The default value of the Format is “d.”

Output:

DateFormat.png

Conclusion
I hope you enjoyed learning how to change the format of the Date Editor in .NET MAUI DataForm (SfDataForm).

Refer to our .NET MAUI DataForm feature tour page for its other groundbreaking feature representations. You can also explore our .NET MAUI DataForm documentation to understand how to present and manipulate data.

For current customers, check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI DataForm and other .NET MAUI components.

Please let us know in the following comments section if you have any queries or require clarifications. Contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied