How To zoom In PanAndZoomImage By code

5 posts, 0 answers
  1. Eng
    Eng avatar
    21 posts
    Member since:
    Jun 2013

    Posted 16 Jun 2013 Link to this post

    How to over ride zoom event in PanAndZoomImage  , i want to zoom in when  page orientation change event
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 17 Jun 2013 Link to this post

    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.
  3. DevCraft banner
  4. Eng
    Eng avatar
    21 posts
    Member since:
    Jun 2013

    Posted 17 Jun 2013 Link to this post

    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



     
  5. Eng
    Eng avatar
    21 posts
    Member since:
    Jun 2013

    Posted 17 Jun 2013 Link to this post

    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.
  6. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 18 Jun 2013 Link to this post

    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.
Back to Top
DevCraft banner