This is a migrated thread and some comments may be shown as answers.

PanAndZoomImage reseting zoom

2 Answers 67 Views
SlideView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jakub
Top achievements
Rank 1
Jakub asked on 06 Mar 2012, 11:11 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Deyan
Telerik team
answered on 08 Mar 2012, 01:42 PM
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 >>
0
Jakub
Top achievements
Rank 1
answered on 10 Mar 2012, 01:10 AM
Hi

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

regards
Jakub Florczyk
Tags
SlideView
Asked by
Jakub
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Jakub
Top achievements
Rank 1
Share this question
or