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. Image for the cookie policy date
close icon

DataBinding not working with this control

Hello,

Unfortunatelly the data binding not working with this control. When I change the value of the conrol, the model is not updated (the model property is always null).

I attach a sample project to show this behavior. Please follow the steps in the Form to reproduce the issue.



Thank you for help!


BR, SZL


Attachment: WinFormsApp1_8432c0f9.zip

5 Replies

BA BagavathiPerumal Apranandham Syncfusion Team September 30, 2022 05:12 AM UTC

Hi SZL,


We have already confirmed the reported scenario is a defect and logged a report for the reported scenario “Binding Value property of SfDateTimeEdit is not working”. We have found the cause for the binding issue when using Custom Delegate for the ValueChanged event, the binding is not working properly.


If we have used EventHandler delegate for the event it is working fine. We have reported this issue to Microsoft, and we will wait until we get a response.


Please find the details from the below link

https://github.com/dotnet/winforms/issues/7820



Regards,
Bagavathi Perumal A



SZ SZL replied to BagavathiPerumal Apranandham September 30, 2022 11:15 AM UTC

Hi,

Ok, thank you! Can you help me please what do you mean about this:

" If we have used EventHandler delegate for the event it is working fine."

Do you have a little example code what need I do to work this (use this workaround)?

Thank you!



GT Gokul Thanudhas Syncfusion Team October 3, 2022 04:54 PM UTC

Hi SZL,


In our DateTimeEditControl, we have used CustomDelegate(ValueChangedEventHandler) for the ValueChanged event. When using the custom delegate the binding is not working properly. If we use EventHandler delegate for the ValueChanged event the Binding is working properly. We have reported this as an issue in winforms github. Please find the details in the below link.



As a workaround create a custom control with base as DateTimeEdit. Create a DateTime? type property in the custom control and add binding for this property in the sample as per your requirement. Update this property in ValueChanged event. We have created the sample based on your requirement, please refer to the sample for your reference.


Regards,

Gokul T


Attachment: SfDateTimeEdit_65ff89a1.zip


SZ SZL October 3, 2022 07:12 PM UTC

Thank you for the example, its working on my project too.

BR, SZL



GT Gokul Thanudhas Syncfusion Team October 4, 2022 02:08 PM UTC

Hi SZL,


The given solution is a workaround. As it should be possible to bind directly with the `Value` property, we have logged a defect.“Binding Value property of SfDateTimeEdit is not working”.


You can track the status of this defect using the following feedback link

https://www.syncfusion.com/feedback/36796/binding-value-property-of-sfdatetimeedit-is-not-working

If you have any more specification replication procedures or a scenario to be tested, you can add it as a comment in the portal.


Please let us know if you need any further assistance



Regards,

Gokul T.



Loader.
Live Chat Icon For mobile
Up arrow icon