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

How To zoom In PanAndZoomImage By code

4 Answers 66 Views
PanAndZoomImage
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eng
Top achievements
Rank 1
Eng asked on 16 Jun 2013, 03:36 PM
How to over ride zoom event in PanAndZoomImage  , i want to zoom in when  page orientation change event

4 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 17 Jun 2013, 10:54 AM
Hello Eng Dev,

You can zoom programmatically with the Zoom property of PanAndZoomImage. Just make sure that ZoomMode is set to Free.
If you have more questions, please write again.

Regards,
Victor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Eng
Top achievements
Rank 1
answered on 17 Jun 2013, 11:04 AM
i put  PanAndZoomImage inside  RadSlideView i want to zoom in this  PanAndZoomImage when orientation change event and how to acess   PanAndZoomImage  inside   RadSlideView  to change it's default values



 
0
Eng
Top achievements
Rank 1
answered on 17 Jun 2013, 12:56 PM
i tried this code 
PanAndZoomImage currentPanAndZoomImage = ElementTreeHelper.FindVisualDescendant<PanAndZoomImage>(this.slideView.SelectedItemContainer);
            currentPanAndZoomImage.ZoomMode = ImageZoomMode.Free;
            currentPanAndZoomImage.Zoom =2;
it throw this exception
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
0
Victor
Telerik team
answered on 18 Jun 2013, 07:28 AM
Hello Eng Dev,

Thanks for writing again.
Since the PanAndZoomImage is inside a DataTemplate in this case, you do not have direct access to it. In order to make it zoom on orientation change you need to create a view model object, insert it inside App's resources and bind PanAndZoomImage to the Zoom property of your view model. The view model needs to implement the INotifyPropertyChanged interface and needs to update its Zoom property when the page orientation changes. Finally, the binding of the zoom property should be a TwoWay binding so that when you zoom inside your slide view, the binding does not break.

Another approach is to bind the Zoom property of your PanAndZoomImage to the Orientation property of your page. By using a binding value converter you can translate the orientation to a zoom factor.

Regards,
Victor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
PanAndZoomImage
Asked by
Eng
Top achievements
Rank 1
Answers by
Victor
Telerik team
Eng
Top achievements
Rank 1
Share this question
or