Custom Control support in InfoPath (Part I - Simple Binding)

Over the last year and a half, the InfoPath team has been working on the SP1 release. If anyone's seen the list of features, you'll notice that there are new features with a service pack release. The feature which I've worked on mostly was the custom control support. Basically allowing developers to create and use ActiveX controls within InfoPath. I have a post here: but I'll go over the individual binding types seperately because they get a little confusing. What is binding? If you're familiar with InfoPath, you'll notice that behind the scenes, InfoPath stores everything in xml. Each control is associated with some part of the xml. “Binding“ is the term that we use to refer to the connection between the xml and the control.

The first one we'll go over today is the most basic type of binding: Simple Binding.

As the name suggests, it's very simple. ActiveX controls which are set to simple binding will bind to basic data types like strings, numbers, dates, etc... This type of binding is very similar to the rest of the InfoPath controls. For example, textboxes are controls that have simple binding to a string node (by default, but you can change that). Date controls are usually bound to date types. With this type of binding, InfoPath developers can write custom controls and have it save simple types of data into your xml. One example would be a calculator (like the popup ones in MS money). This would provide an in-doc calculator and it could save the number in the xml after the user has calculated whatever number was needed. So simple binding is ideal if you have a single piece of data. If you have multiple pieces of data, you should look into the other bindings.

Sometimes people are tempted to exclusively use this type of binding and avoid the others because they're unfamiliar with the others. We'll go over those later, but here are things to avoid when using simple binding.
Don't try to stuff multiple values into a simple binding. If you have a list of numbers, lets say like stock quotes, you wouldn't want to use simple binding. Yes you could just delimit them with a pipe ( | ) or comma ( , ). It will work, but the whole point of xml is to have structured storage of data. Also, if you have a large amount of information, you could mime or base64 encode everything and stick it in a string. This will also work, but it will make it very hard for other apps to read this xml file. For those two scenarios, the other types of bindings where created.