Share via


View3.GetContextNodes Method (Object, Object)

Gets a reference to an XMLNodesCollection collection that is populated with XML Document Object Model (DOM) nodes based on the current context.

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)

Syntax

'Declaration
Function GetContextNodes ( _
    varNode As Object, _
    varViewContext As Object _
) As XMLNodesCollection
'Usage
Dim instance As View3
Dim varNode As Object
Dim varViewContext As Object
Dim returnValue As XMLNodesCollection

returnValue = instance.GetContextNodes(varNode, _
    varViewContext)
XMLNodesCollection GetContextNodes(
    Object varNode,
    Object varViewContext
)

Parameters

  • varViewContext
    Type: System.Object

    The ID of the control that is used for the context.

Return Value

Type: Microsoft.Office.Interop.InfoPath.XMLNodesCollection
A reference to the XMLNodesCollection.

Implements

View2.GetContextNodes(Object, Object)

Remarks

The collection returned by the GetContextNodes method consists of the sequence of XML DOM nodes that are mapped from the view, corresponding to the current XSL Transformation (XSLT) node, starting at the current selection and walking up through the view ancestors to the BODY tag.

If no parameters are used, the context nodes are based on the current selection. If parameters are used, then the context nodes returned are those that would be returned based on the selection that would be obtained from calling the SelectNodes(IXMLDOMNode, Object, Object) method.

Note

The GetContextNodes method will not return nodes based on the current selection if used in the OnClick event of a button in the view, since the focus is lost from the control that is intended to be in context. To avoid this behavior, use the GetContextNodes method from a custom task pane, menu or toolbar.

See Also

Reference

View3 Interface

View3 Members

GetContextNodes Overload

Microsoft.Office.Interop.InfoPath Namespace