Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Odd behavior in bound checkbox.

$
0
0

Hello all:

C#.Net 4.0 WinForms project. I am experiencing some odd behavior with form controls bound to a custom class. What I am seeing is this: when the user alters data inside any of the TextBox controls, and then immediately toggles a CheckBox control, the TextBox loses the data that had just been entered. If the user alters data in a TextBox then clicks inside another TextBox and alters data, both Textboxes maintain their data. As Far as I can tell, it’s as if the call to ‘commit’ the data to the underlying class property is somehow skipped when immediately clicking on the CheckBox.  

The custom class does implement INotifyPropertyChanged and the databindings do actually work bi-directionally, except for this one quirk. I have tried binding control properties directly to class properties, and have also tried using a BindingSource in between, but the results are identical.

If I manually push control data to the class properties using the _Leave event of the control then I can alter TextBox data, immediately click the CheckBox, and maintain the TextBox data. But this is obviously a kludge fix as databinding should be able to handle this.

Has anyone encountered this issue before? Thanks, and happy weekend.

Kurt


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>