ViewInfo.Caption Property
Gets the value of the caption attribute of the xsf:view element associated with the view in the form definition file (.xsf).
Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)
Syntax
'Declaration
'Usage
Property Value
The value of the caption attribute of the xsf:view element associated with the view in the form definition file (.xsf)
Remarks
By default, the value of the caption attribute of the xsf:view element is the same as the name given to the view when it was created in InfoPath form template design mode. As a result, the Caption property will return the same value as the Name property by default.
The Caption property can be used to facilitate two scenarios:
To create a localized version of a view's name. You can save the form template files as source files (Save As Source Files on the File menu), and then hand edit the form definition file (.xsf) to change the value of the caption attribute of a xsf:view element to give the view a localized name. After doing so, the Caption property can be used to return the localized name.
When InfoPath is hosted as a control using the FormControl in another application or in the FormViewControl on InfoPath Forms Services, the value of the caption attribute can be used to create a drop-down list for switching views. For example, when the selected item is changed the drop-down list control would use FormControl.XmlForm.ViewInfos.SwitchView() method to switch views using the view name value returned by the Name property, but using the localized value returned by the Caption property for user interface text.
Important
When using a property to pass the name of a view to the SwitchView(String) method, you should only use the value returned by the Name property.
See Also
Reference
ViewInfo Class
ViewInfo Members
Microsoft.Office.InfoPath Namespace