docs

Control Properties and Associations in XML Views


Properties

Property values for controls in XML views are specified as attributes of the XML element tag of the control. The name of the attribute corresponds to the name of the property in the API reference, for example, the property text of a the sap.m.Text control is specified as text="value".

Note:

The XML view offers special handling for context bindings and style classes. You can specify them via the binding and class attributes on a control’s XML node.

Please be aware that these attributes are not properties of the respective controls and thus are not supported by a control’s constructor. For more information, see Context Binding (Element Binding)and Using CSS Style Sheets in XML Views (deprecated).

Note:

Escape characters that have a special meaning in XML (like <, or &) when they occur in a property value. Use XML entities instead (like &lt; instead of a <, or &amp; instead of &).

Attributes in XML views use the same binding syntax as constructors of controls. For example, "{customerName}" is used to bind a property against the model property with name "customerName".

Example: sap.m.Text with plain text:

<Text text="My Text"/>

Example: sap.m.Text with text provided by a binding:

<Text text="{customerName}"/>

Example: sap.m.Text with escaped special characters:

<Text text="&lt;div&gt;My HTML Text&lt;/div&gt;"/>

Note:

Properties of type function can be specified similar to event handlers in XML views. However, the legacy syntax of function names without dots is not supported.


Associations