Data binding with TX Text Control .NET for Windows Forms

The same functionality is available in the Windows Forms version as well. Windows Forms offers a similar way of binding properties to data sources or other properties. But the binding is not added in XAML (which is a concept of WPF), but the code itself. But the advantage is still valid: The presentation layer can be abstracted and no additional event handling is required to update the state of specific buttons or menu entries.

The TextControl.InputFormat class is available in the Windows Forms version as well. The properties of this class can be bound to other controls.

The following code shows how to bind a CheckBox that is displayed as a toggle button to the Bold property of the TextControl.InputFormat class:

checkBox1.DataBindings.Add("Checked", textControl1.InputFormat, "Bold", true, DataSourceUpdateMode.OnPropertyChanged);
[Visual Basic]
CheckBox1.DataBindings.Add("Checked", TextControl1.InputFormat, "Bold", True, DataSourceUpdateMode.OnPropertyChanged)

<< Previous