Winforms binding null property

I use EF / POCO objects and some strange things happen when binding a text field to a nullable double. After entering the values ​​and changing the focus to the next value, the field that I just edited is cleared. I bind my properties as follows:

distanceTextEdit.DataBindings.Add("Text", _routeControlVM.Route, "Distance", false, DataSourceUpdateMode.OnPropertyChanged, string.Empty); 

What can cause this behavior?

EDIT: Good. The problem was with the DataBindings API. I just changed false to true and now everything works.

+4
source share
1 answer

Data must be formatted before it can be bound to NULL properties, where I see that you disable it exclusively. Try to enable formatting.

EDIT : I just noticed that you have already enabled formatting with DataBindings.Add(.., .., .., true, ..);

+4
source

All Articles