The View object provides programmatic access to Views stored within an InfoPath solution. A form may have multiple views but there is always one default view. When using the View object, you are always accessing the currently active View . The View object supports the properties and methods shown in Table A.15.
Name | Security Level | Description |
---|---|---|
DisableAutoUpdate Method | 2 | Disables the automatic synchronization between the View object and the underlying XML data. |
EnableAutoUpdate Method | 2 | Enables the automatic synchronization between the View object and the underlying XML data. |
ExecuteAction Method | 2 | Enables the ability to programmatically perform built-in InfoPath editing commands as if the user has selected these from the menus . |
Export Method | 3 | Exports the current file to a file. |
ForceUpdate Method | 2 | Forces synchronization of the current View to the underlying XML data. It is often used to synchronize views based on changes to a secondary data source. |
GetContextNodes Method | 2 | Provides a reference to a collection of XML nodes populated from the DOM based on the current context. These are the sequence of XML DOM nodes mapped from the current view that correspond to the current XSLT transform that has been applied. |
GetSelectedNodes Method | 2 | Provides a reference to a collection of XML nodes that are populated from the DOM based on the current selection of view items. |
SelectText Method | 2 | Selects the current text contained in an editable field specified in the DOM. |
SwitchView Method | 2 | Changes the current active view to the one specified. |
Name Property | 2 | Is a read-only string that contains the name of the current view. |
Window Property | 2 | Is a read-only property that contains a reference to the Window object associated to the current view. |
The following example changes the current view to the default view specified in the solution file:
XDocument.View.SwitchView("");