DocContextChangeEvent.Context 属性

定义

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

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

属性值

示例

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

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;
 }
}

适用于