Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 44
Registered: ‎02-11-2013
My Device: Z10
My Carrier: TELE2
Accepted Solution

ImageView scaling in ScrollView

Hi all, my image is much bigger than screen size and it is scaling fine during onPinchUpdated() signal, but after that it comes to the normal size. How to scale correct within the ScrollView? Because without ScrollView it works fine. Here is my code:

ScrollView {
  id: myScroll
  ImageView {
    id: myImage
    property double initialScale: 1.0
    property double scaleFactor: 0.8
    imageSource: "asset:///images/bigpic.jpg"
    gestureHandlers: [
      PinchHandler {
        onPinchUpdated: {
          myImage.scaleX = myImage.initialScale + ((event.pinchRatio - 1) * myImage.scaleFactor);
          myImage.scaleY = myImage.initialScale + ((event.pinchRatio - 1) * myImage.scaleFactor);
  scrollViewProperties {
      ScrollMode: ScrollMode.Both


Posts: 103
Registered: ‎12-31-2012
My Device: Blackberry 9810
My Carrier: Verizon

Re: ImageView scaling in ScrollView

You could use the pinchToZoomEnabled property... and leave the scaling to the OS


 ScrollView {
            scrollViewProperties {
                scrollMode: ScrollMode.Both
                pinchToZoomEnabled: true