locked
How to set width and height when I use VirtualSurfaceImageSource and without ScrollViewer?

    Question

  • I implement virtualsurfaceImagesource in C++, and I add an image control in Xaml. Firstly, I create a new instance of VirtualSurfaceImageSource(3000,3000, false), and set the width and height of image control as 1500. The result is the whole image are drawn instead of a half.
    Tuesday, December 31, 2013 3:49 AM

All replies

  • Hi minLVwang,

    >>We designed virtualSurfaceImageSource to be used when displaying complex content that is larger than the screen, especially when it can be panned or zoomed.

    From http://blogs.msdn.com/b/windowsappdev/archive/2012/03/15/combining-xaml-and-directx.aspx

    >>This works especially well when you place your VirtualSurfaceImageSource content in a ScrollViewer to enable smooth panning with touch or a mouse.           

    I don't know where do you put your VirtualSurfaceImageSource content, but I think if you put the content to a container which provides scroll ability, it won't be autoscaling.

    Regards!

    Xiaoliang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 2, 2014 6:58 AM
    Moderator
  • Hi Xiaoliang,

    I got what did you said. But I think the VirtualSurfaceImageSource has many limitations.

    1. It does not work well when the image has not been placed in the ScrollViewer. Because the the image could not be panned or zoomed, the UpdateNeeded method could not be invoked.
    2. The displaying content will be devided into many parts. For instance, when I create a new instance of VirtualSurfaceImageSource(4801, 3000, false). The Width of per tiles is 504. I dont know how to culculate these values by framework. But when I load an image (256 * 256), the width of image are not corresponseding with the width of tiles. I should write many logical codes to deal with it. (Maybe I should use SurfaceImageSource better.)
    3. The width of Image control and the width of VirtualSurfaceImageSource are restrict the tiles which we will be drawn. For instance, the width of Image control is 500, the width of VirtualSurfaceImageSource is 4801, the content is devided into 10 tiles. When I load the application, I expect to load 2 tiles, but unfortunately, 10 tiles are drawn(The application has no ScrollViewer).
    Friday, January 3, 2014 3:35 AM
  • Hi minLVwang,

    This object is for the large image which couldn't be displayed in your screen. It will draw the displayed section only, and if you move it by scrollviewer, the image will be redrawed, but it will also only display the specified section.

    This mechanism is more like the situation that when we review web page on IE browser. Every time the browser loads a web page, it won't load all the content, only when you scroll the scroll bar, the rest of the content will be loaded. This will give the users a better experience because he think the server responses him very fast and saves him much time.

    Best Regards!

    Xiaoliang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 7, 2014 2:47 AM
    Moderator