Partager via


Custom Control support in InfoPath (Part II - Stream Binding)

Continuing (from Part I) on, we will discuss the second type of binding available to ActiveX controls within InfoPath. This one is called “Stream Binding” (which corresponds to the “Field element with custom data type“ in the drop down of the custom control wizard).

Remember in the first binding type(simple) I mentioned that it's not good for storing multiple values. Stream binding is a type where multiple values can be store. But it does oh so much more. What do we mean by “stream”? Basically, stream binding allows ActiveX controls to save arbitrary xml into your InfoPath form. Yes arbitrary. But wait, you say. My form has a schema. Yes it does, so stream binding will ask for a different namespace which your control can write whatever arbitrary xml into without making your InfoPath xml file invalid because it's in a different namespace than your InfoPath form schema. To give an example of how that happens, there is actually a built in control that does something similar to stream binding. The rich-text box control that comes in the standard controls just saves rich-text via xhtml. The xhtml schema isn't embedded into a form which has a rich-text box, rather, it writes out all the xhtml into another namespace. The rich-text node in the schema just specifies that the xml in that node be part of the https://www.w3.org/1999/xhtml schema.

This type of binding is good for cases when you want to store multiple values and not have to require InfoPath form developers to create the appropriate nodes in the data source. When a stream bound ActiveX control is added into the form, it will just create one node which will point to a different namespace. The benefit of this is that form developers will not have to create a particular structure if they want to use this control. Stream binding is an excellent choice if an ActiveX control already outputs xml.

Now what happens if you want your ActiveX control to interact with multiple nodes within your form? This obviously won't work with stream binding because stream binding will write xml in a different namespace. This is where the third type of binding comes in.... stay tuned...

Comments

  • Anonymous
    September 17, 2007
    OneoftheproblemswithInfoPathcontrolsistheirlimitedavailability.Forexample,thereisnos...
  • Anonymous
    October 10, 2007
    CustomControlsupportinInfoPath(PartI-SimpleBinding)Published07July0411:32AM|ajma