在Infopath中使用自定义控件不能激发 OnPropertyChange 事件

InfoPath has a really powerful feature to allow users to create their own custom controls for InfoPath forms using Microsoft's ActiveX technology. One requirement that is essential for controls to work as expected in InfoPath is that the controls must fire OnPropertyChange Notifications so that InfoPath knows to grab the information and copy it into the XML DOM. The unfortunate thing is that there are some already built controls which don't fire OnPropertyChange Notifications but they would be incredibly useful in an InfoPath form.

Here's what to do if you want to use these types of controls. InfoPath will grab the value before you save, so if you don't need other parts of the form to interact with the data from the ActiveX control, then you don't really need to do anything. Your data from the ActiveX control will always get saved.

If you do need to pull data from the ActiveX control before it is saved (maybe for example on a OnAfterChange or a button click), you should call XDocument.ForceUpdate(); before grabbing the value. This will cause InfoPath to query the ActiveX control for the value and place it into the XML DOM so then your business logic will be able to get the correct value.

from: http://blogs.msdn.com/infopath/archive/2004/04/30/123946.aspx

posted on 2010-05-14 11:04  一粒沙  阅读(236)  评论(0编辑  收藏  举报