Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.74 KB

xml-view-91f2928.md

File metadata and controls

34 lines (23 loc) · 1.74 KB

XML View

The XML view type is defined in an XML file, with a file name ending in .view.xml. The file name and the folder structure together specify the name of the view that equals the OpenUI5 module name.

Example:

For resources/sap/hcm/Address.view.xml, the view name is sap.hcm.Address. The application uses this view name for displaying an instance of this view. If you define the XML view by means of an XML string, no file or define/require is needed.

The file looks as follows:

<mvc:View controllerName="module:sap/hcm/Address" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc">
   <Panel>
      <Image src="http://www.sap.com/global/ui/images/global/sap-logo.png"/>
      <Button text="Press Me!"/>
   </Panel>
</mvc:View>

Nest the XML tags analogous to the nesting sequence of OpenUI5 controls and add the property values as attributes (see Namespaces in XML Views).

Each control or element is represented by an XML tag with the name of the control. If you, for example, want to create an instance of a sap.m.Button, you use the <Button> tag with the sap.m namespace.

You can create a context binding for the control by using the binding attribute. For more information, see Context Binding (Element Binding).

You can refer to a style class for the control by using the class attribute.For more information, see Using CSS Style Sheets in XML Views (deprecated).

Related Information

API Reference: sap.ui.core.mvc.XMLView