PanAndZoomImage reseting zoom

3 posts, 1 answers
  1. Jakub
    Jakub avatar
    5 posts
    Member since:
    Aug 2012

    Posted 06 Mar 2012 Link to this post

    Hi

    I'm using PanAndZoomImage out of SlideView control, just for displaying images. My question is how to reset zoom after changng source. For example I'm loading one picture, then I'm zooming and loading another one. But the second picture is zoomed like first one. I didn't find any "reset" method to restore control state. Any idea how to resolve it?

    Second is just request to animate gesture flick. Because now zoomed picture is just moving instead of animating base on power of flick.

    regards
    Jakub Florczyk
  2. Answer
    Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 08 Mar 2012 Link to this post

    Hi Jakub,

    Currently there is no API that will allow you to reset the zoom of PanAndZoomImage. You can, however, use the following code snippet as a workaround to reset the zoom for the currently active item:

    PanAndZoomImage currentPanAndZoomImage = ElementTreeHelper.FindVisualDescendant<PanAndZoomImage>(this.slideView.SelectedItemContainer);
     
    Image imageElement = ElementTreeHelper.FindVisualDescendant<Image>(currentPanAndZoomImage);
    (imageElement.RenderTransform as CompositeTransform).ScaleX = 1;
    (imageElement.RenderTransform as CompositeTransform).ScaleY = 1;
     
    (imageElement.RenderTransform as CompositeTransform).TranslateX = 0;
    (imageElement.RenderTransform as CompositeTransform).TranslateY = 0;

    We will consider extending the API of the control to allow resetting the zoom factor of the selected item for the future. We will also consider adding the flick gesture support when panning the zoomed item.

    I have added 800 Telerik points to your account for these suggestions.

    Let me know in case you have further questions or need assistance.

    Greetings,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Jakub
    Jakub avatar
    5 posts
    Member since:
    Aug 2012

    Posted 09 Mar 2012 Link to this post

    Hi

    Thanks for the points and code - it's working well :)

    regards
    Jakub Florczyk
Back to Top