Edit

Share via


View Class

Definition

Represents a view within a form.

public ref class View abstract
public abstract class View
type View = class
Public MustInherit Class View
Inheritance
View

Examples

The View object that represents the current view is accessed using the CurrentView property of the XmlForm class. In the following example, first a View object is created to reference the form's currently active view. Then, the ViewInfo property is used to access the ViewInfo object for the view and display its name in a message box.

// Set a reference to the current view.
View thisView = this.CurrentView;

// Display the view's name.
MessageBox.Show(thisView.ViewInfo.Name);
' Set a reference to the current view.
Dim thisView As View = Me.CurrentView

' Display the view's name.
MessageBox.Show(thisView.ViewInfo.Name)

To change the currently active view, use the SwitchView method of the ViewInfoCollection class as shown in the following example.

this.ViewInfos.SwitchView("View2"); Me.ViewInfos.SwitchView("View2")

To force an update of a view to display information that has been programmatically changed in the form's underlying XML document, you can use the ForceUpdate() method of the View class, as shown in the following example.

this.CurrentView.ForceUpdate(); Me.CurrentView.ForceUpdate()

Remarks

The View class provides properties and methods that can be used to programmatically interact with an InfoPath view, including methods for selecting data contained in the view, switching from one view to another, synchronizing the view with a form's underlying XML document, and executing an InfoPath editing action.

Note: The InfoPath object model does not provide a collection of View objects, but it does provide the ViewInfoCollection class which provides a collection of ViewInfo objects, each of which provides information about the corresponding view it represents. Additionally, the View class provides the ViewInfo property, which allows you to access information about the associated view.

Constructors

View()

Properties

SignatureLines

Gets a reference to the SignatureLineCollection associated with the current view.

ViewInfo

Gets a reference to a ViewInfo object associated with the view.

Window

Gets a reference to a Window object associated with the view.

Methods

DisableAutoUpdate()

Disables automatic synchronization between a form's underlying XML document and the associated view.

EnableAutoUpdate()

Enables automatic synchronization between a form's underlying XML document and the associated view.

ExecuteAction(ActionType, String)

Executes an editing command against a form's underlying XML document, based on the specified field or group.

ExecuteAction(ActionType)

Executes an editing command against a form's underlying XML document, based on the data currently selected in the view.

Export(String, ExportFormat)

Exports the view to a file of the specified format.

ForceUpdate()

Forces synchronization between a form's underlying XML document and the associated view.

GetContextNodes()

Gets a reference to an XPathNodeIterator for iterating over the returned XML nodes in the current selection.

GetContextNodes(XPathNavigator, String)

Gets a reference to an XPathNodeIterator for iterating over the returned XML nodes in the current selection within the control bound to the specified control.

GetContextNodes(XPathNavigator)

Gets a reference to an XPathNodeIterator object for iterating over the returned XML nodes starting from the specified node.

GetSelectedNodes()

Gets a reference to an XPathNodeIterator object for iterating over all XML nodes in the current selection of items in a view.

SelectNodes(XPathNavigator, XPathNavigator, String)

Selects a range of nodes in a view based on the specified starting XML node, the ending XML node, and the specified control.

SelectNodes(XPathNavigator, XPathNavigator)

Selects a range of nodes in a view based on the specified starting XML node and ending XML node.

SelectNodes(XPathNavigator)

Selects a range of nodes in a view based on the specified starting XML node.

SelectText(XPathNavigator, String)

Selects the text contained in an editable control that is bound to the node specified by the XPathNavigator object and ViewContext identifier of the control.

SelectText(XPathNavigator)

Selects the text contained in an editable control that is bound to the node specified by the XPathNavigator object passed to this method.

ShowMailItem(String, String, String, String, String)

Creates an e-mail message containing the current view.

Applies to