Ali Ok
Ali Ok

Reputation: 734

Use custom control in XML views

How can one use a custom control in an XML view?

I have a control named foo.bar.MyControl which extends sap.m.Button.

I want to use that control in my XML view:

<mvc:View xmlns:mvc="sap.ui.core.mvc">
  <!-- What to type here ??? -->
</mvc:View>

Upvotes: 1

Views: 2037

Answers (1)

TobiasOetzel
TobiasOetzel

Reputation: 483

Try the following:

<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:foobar="foo.bar">
  <foobar:MyControl>
    <!-- ... -->
  </foobar:MyControl>
</mvc:View>

Namespaces reflect the javascript namespace and MyControl is the constructor function.

More about namespaces in XML views: https://sdk.openui5.org/topic/2421a2c9fa574b2e937461b5313671f0

Best Regards, Tobias

Upvotes: 4

Related Questions