TX Text Control .NET for Windows Forms Data Binding
TX Text Control .NET for Windows Forms 16.0 supports property data binding through the InputFormat class, similar to WPF XAML binding but configured in code. This walkthrough binds a CheckBox to the Bold property and a ComboBox to FontFamily, removing the need for manual event handlers.

The new WPF version of TX Text Control comes with new data binding possibilities. But 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);
But what about a ComboBox that should list all available fonts, display the font at the current input position and apply a new font to the selection when the user selects another font in the ComboBox?
First, we can bind the DataSource property of the ComboBox to the GetSupportedFonts method of TX Text Control. This method returns all supported fonts that can be actually used in the document. The Text property of the ComboBox can be bound to the FontFamily property of the TextControl.InputFormat class. And that is all you need to connect the ComboBox to TX Text Control. No event handling, no Selection class.
comboBox1.DataSource = textControl1.GetSupportedFonts();
comboBox1.DataBindings.Add("Text",
textControl1.InputFormat,
"FontFamily",
true,
DataSourceUpdateMode.OnPropertyChanged);Related Posts
Announcing TX Text Control DS Server 5.0
We are excited to announce the release of TX Text Control DS Server 5.0. This release focuses on extensibility, plugin integration, and developer productivity while continuing to improve the…
TX Text Control 34.0 SP2 is Now Available: What's New in the Latest Version
TX Text Control 34.0 Service Pack 2 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…
TX Text Control 34.0 SP1 is Now Available: What's New in the Latest Version
TX Text Control 34.0 Service Pack 1 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…
Introducing TX Text Control 34.0: Your Next Leap in Document Processing
We are happy to announce the release of TX Text Control 34.0. This version is packed with new features and enhancements that will elevate your document processing experience. This version…
PDF/UA vs. PDF/A-3a: Which Format Should You Use for Your Business Application?
In this blog post, we will explore the differences between PDF/UA and PDF/A-3a, helping you choose the right format for your business needs. We will discuss the key features, benefits, and use…
