DocContextChangeEvent.Context 属性

定义

获取对 XML 文档对象模型的引用 (DOM) 节点,该节点是由 对象提供 DocContextChangeEventObject 的新上下文节点。

public:
 property Microsoft::Office::Interop::InfoPath::SemiTrust::IXMLDOMNode ^ Context { Microsoft::Office::Interop::InfoPath::SemiTrust::IXMLDOMNode ^ get(); };
public Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode Context { get; }
member this.Context : Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode
Public ReadOnly Property Context As IXMLDOMNode

属性值

示例

在以下示例中,将更新名为 的 lastChanged 节点以响应上下文更改:

[InfoPathEventHandler(EventType=InfoPathEventType.OnContextChange)]
public void OnContextChange(DocContextChangeEvent e)
{
 if ( e.Type == "ContextNode" && !e.IsUndoRedo )
 {
  IXMLDOMNode contextNode = e.<span class="label">Context</span>;
  IXMLDOMNode lastChangedNode = thisXDocument.DOM.selectSingleNode("my:lastChanged");
  lastChangedNode.text = contextNode.nodeName;
 }
}

注解

重要提示:此成员只能由与当前打开的窗体在同一域中运行的表单访问,或者由已授予跨域权限的表单访问。

适用于