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

DataBingding not working with custom SfButton

Hello,

I created my own control based on SfButton -> MyNumericButton.

When I click on this button at runtime its value changing to 7.7 (example), but the datasource is not updated when I setup a data binding. The data binding has no effect (I use INotifyPropertyChanged too).

I attach a sample project:

  1. When you click on button, its Text should change to 7.7. This is ok.
  2. This operation should update the datasource too with data binding, but nothing happen.
  3. When I click on Check button, the MessageBox should show 7.7 too, but it is empty text.


Can you help me please why my databinding has not effect?

My binding code:

   myNumericButton1.DataBindings.Clear();

  myNumericButton1.DataBindings.Add("TextValue", MyModel2, nameof(MyModel2.SablonSzerkesztesIdoGepiButton), true, DataSourceUpdateMode.OnPropertyChanged);

I attach my sample to show this behavior.


Thank you very much for help!


BR, SZL



Attachment: Sample_f7adbea9.zip

4 Replies

SZ SZL November 15, 2022 11:42 AM

Hello,

I find the soultion based on this post:

https://www.syncfusion.com/forums/177874/databinding-not-working-with-this-control

Do you have information about the fix in the future?


Thank you!

BR, SZL



GT Gokul Thanudhas Syncfusion Team November 16, 2022 09:45 AM

Hi SZL,


The reported issue is not from our control side. We have faced a similar issue from our side and reported to Microsoft team regarding this. Please find the details in the below link.


Binding is not working properly when using custom delegate and Generic EventHandler for respective properties · Issue #7820 · dotnet/winforms (github.com)


We have modified the sample based on your requirement, in which we have changed the CustomDelegate to Eventhandler Delegate. Please refer to the attached sample for your reference.


Regards,

Gokul T




Attachment: Sample_1fbef34f.zip


SZ SZL replied to Gokul Thanudhas November 17, 2022 04:47 AM

Hi,


Thank you very much!


I can work with these workarounds now.


BR, SZL



HN Harinath Navaneethakrishnan Syncfusion Team November 18, 2022 12:24 AM

We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out.


Loader.
Live Chat Icon For mobile
Up arrow icon