winforms_databinding_sample
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
winforms_databinding_sample [2018/07/29 05:11] – created wolfgangriedmann | winforms_databinding_sample [2018/07/29 05:28] (current) – wolfgangriedmann | ||
---|---|---|---|
Line 5: | Line 5: | ||
As usual, it requires at least one line of code for every field: | As usual, it requires at least one line of code for every field: | ||
- | [code]oTextBox: | + | <code visualfoxpro> |
where '' | where '' | ||
It is very easy to implement name based binding in WinForms. You need a similar method of ther following in your window: | It is very easy to implement name based binding in WinForms. You need a similar method of ther following in your window: | ||
- | [code]method Use( oViewModel as INotifyPropertyChanged ) as void | + | <code visualfoxpro> |
local oControls as System.Windows.Forms.Control.ControlCollection | local oControls as System.Windows.Forms.Control.ControlCollection | ||
local oTextBox as TextBox | local oTextBox as TextBox | ||
Line 23: | Line 23: | ||
next | next | ||
- | return[/code] | + | return</code> |
and then you can combine your form (or View as in MVVM) with a simple statement: | and then you can combine your form (or View as in MVVM) with a simple statement: | ||
- | [code]oForm:Use( oViewModel )[/code] | + | <code visualfoxpro> |
Of course you should enhance your method to implement databinding also for the other types of controls you use, and you should put them in your windows base class from which all your forms/Views will be inherited. | Of course you should enhance your method to implement databinding also for the other types of controls you use, and you should put them in your windows base class from which all your forms/Views will be inherited. | ||
+ | |||
+ | A sample as XIDE export file can be found here: {{ : | ||
winforms_databinding_sample.1532841097.txt.gz · Last modified: 2018/07/29 05:11 by wolfgangriedmann