DocContextChangeEventObject Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An event object that is used during a Microsoft InfoPath context change event.
public interface class DocContextChangeEventObject : Microsoft::Office::Interop::InfoPath::DocContextChangeEvent
[System.Runtime.InteropServices.Guid("096CD6D2-0786-11D1-95FA-0080C78EE3BB")]
public interface DocContextChangeEventObject : Microsoft.Office.Interop.InfoPath.DocContextChangeEvent
type DocContextChangeEventObject = interface
interface DocContextChangeEvent
Public Interface DocContextChangeEventObject
Implements DocContextChangeEvent
- Derived
- Attributes
- Implements
Examples
In the following example, a node named lastChanged
is updated in response to context changes:
public void OnContextChange(<span class="label">DocContextChangeEvent</span> e)
{
if ( e.Type == "ContextNode" && !e.IsUndoRedo )
{
IXMLDOMNode contextNode = e.Context;
IXMLDOMNode lastChangedNode = thisXDocument.DOM.selectSingleNode("/my:myRoot/my:lastChanged");
lastChangedNode.text = contextNode.nodeName;
}
}
Remarks
This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeDocContextChangeEvent.
The DocContextChangeEvent object provides a number of properties that can be used within a context change to programmatically interact with the data in a form's underlying XML document, to provide contextual feedback to the user, or to perform actions for the user.
The DocContextChangeEvent object is passed as a parameter to the OnContextChange event.
The DocContextChangeEvent object is used to get information about the XML Document Object Model (DOM) node that is the current context of the form's underlying XML document. In addition, it provides information about the type of context change and whether the change happened in response to an undo or redo operation performed by the user.
The Type property returns only the value "ContextNode" for context changes in Microsoft InfoPath 2003 Service Pack 1. Nevertheless, if code in an event handler performs actions that depend on current functionality, that code should still be designed to check the value of the Type property, because future versions of InfoPath may use different values for different context changes.
When the IsUndoRedo property is true, the context change was caused by an undo or redo operation rather than an explicit user context change. Operations performed in an OnContextChange event that modify the XML DOM should be avoided in response to undo or redo actions, because they may interfere with the user's intention to revert data to a previous state.
Properties
Context |
Gets a reference to the XML Document Object Model (DOM) node that is the new context node provided by DocContextChangeEventObject object. (Inherited from DocContextChangeEvent) |
IsUndoRedo |
Gets a value indicating whether the context change event occurred in response to undoing an operation or redoing an operation. (Inherited from DocContextChangeEvent) |
Type |
Gets the type of context change event that occurred when the OnContextChange event was triggered. (Inherited from DocContextChangeEvent) |
XDocument |
Gets a reference to the XDocument object that is associated with the DocContextChangeEventObject object in an OnContextChange event. (Inherited from DocContextChangeEvent) |