nav-title | title | description |
---|---|---|
Image How-To |
How-To |
Examples for using Image |
Using an image requires the Image module to be loaded.
var ImageModule = require("ui/image");
Binding the image source property to a view-model property.
<Page>
{%raw%}<Image source="{{ thumbnailImageSource }}" />{%endraw%}
</Page>
var image = new ImageModule.Image();
image.source = ImageSourceModule.fromResource("logo");
var image = new ImageModule.Image();
image.url = "https://www.google.bg/images/srpr/logo11w.png";
var image = new ImageModule.Image();
image.source = ImageSourceModule.fromFile(imagePath);
// There are 4 modes of stretching none, fill, aspectFill, aspectFit
// The default value is aspectFit.
// Image stretch can be set by using ImageModule.stretch enum.
image.stretch = enumsModule.Stretch.aspectFit;