[SOLVED] Windows Forms data binding issue

Answered Closed
0
0

This is a long standing issue that exists since .NET 2.0 was released. Microsoft didn’t want to solve the issue. You can read a full discussion on the links below.

Windows Forms data binding issue in VS 2005

Windows Forms data binding issue: conclusion

CornStarch – a fixative for Windows Forms Databinding in 2005

In a nutshell, suppose I’m using DataBinding and my business layer decides a given string must be uppercased, say because it’s a family name and in some countries, the family name is uppercased. When I enter the family name in the text box, DataBinding passes the string to the business layer. The business layer changes it to uppercase and notifies the UI layer that there was a change. Every other control can receive the notification but the text box where the name was entered doesn’t receive the notification. Don’t ask why, ask how to solve this awkward behavior.

I attach a triple sample showing this issue in Windows Forms, WebGUI and Wisej. Each sample has two forms, one showing the “normal” behaviour you get from the raw Windows Forms library and another where this issue is fixed. The only difference between the forms is the presence of the BindingSourceRefresh control, the one that fixes DataBinding.

Besides the DataBinding issue, I noticed two other problems:

  1. On Wisej, tabbing out of a text box doesn’t trigger Validation (in this case that’s what triggers DataBinding). To trigger it, you must click away of the text box. Tested on Chrome, Firefox, IE and Edge.
  2. I dont’ understand why, but I couldn’t ran my Wisej application when the AssemblyName didn’t match the RootNamespace. I don’t know whether this a Wisej issue or a VS2015 issue.
  • You must to post comments
Best Answer
0
0

To keep you updated.

  • The data binding issues with events and namespaces are all fixed.
  • We added a new property RefreshValueOnChange to Wisej.Data.BindingSource (default: false). It does what the fix you suggested did, but instead of attaching to all components it does it at the source.
  • Issue 1 is fixed as well. It was a regression caused an enhancement to the textbox in preparation for adding the tools container.
  • The issue 2 is probably caused by not updating the startup property in Default.json. (https://docs.wisej.com/docs/concepts/configuration)  If you change the assembly name then startup=”” should be changed as well.

With the latest fixes (not deployed yet) I could take the sample you attached here, remove all the aliases and run it without changes.

  • You must to post comments
0
0

Hi,

All 3 issues are fixed. Thanks.

  • You must to post comments
0
0

Tiago,

for your convenience I have attached your latest sample with the namespace changes.

For components you can use either System.ComponentModel.Component or Wisej.Web.Component.

In your case it’s better to use System.ComponentModel.Component since it only lives on the server side.
Wisej.Web.Component works the same but are also registered with the ComponentManager which manages the server/client components.

Hope that helps.

Best regards
Frank

  • You must to post comments
0
0

Tiago,

thanks again for your sample and feedback.

Can you please retest with the latest Wisej build (1.2.9) following Luca´s comments ?

Best regards
Frank

  • You must to post comments
Showing 4 results