Hi Micheal,
Pleas see the below code.
View:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="testing.imageXml" xmlns:html="http://www.w3.org/1999/xhtml"> <Page title="Image"> <content> <Image id="img1" alt="alttextimage" src="images/img1.jpg" /> </content> </Page></core:View>
Controller:
onBeforeRendering: function() { this.getView().byId("img1").addStyleClass("myimage"); },
Index.html
Output :
Regards,
KK