Setting ScaleFactor by code

4 posts, 0 answers
  1. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 03 Nov 2014 Link to this post

    Hi,

    I'm using Telerik V2014.2.729.40 and I created a UserControl which contain only a PdfViewer. In my UserControl I have many methods to manipulate the PDF (ie: Print, GotoPage, PageUp, PageDown, FirstPage, LastPage, etc...). One of my method is to add scalling to the PDF (ie: 10%, 25%, 50%, 75%, 100%, 150%, 200%, 500%, 1000% and 2000%). I would like to know how I can bind the value passed to my ScaleFactor (string pScale) to the PDFViewer.

    Thank's
    Alain
  2. Deyan
    Admin
    Deyan avatar
    136 posts

    Posted 04 Nov 2014 Link to this post

    Hello Alain,

    Thank you for contacting us.

    You may use the PercentComboBox control which can be found in Telerik.Windows.Controls.FixedDocumentViewersUI namespace. You may see how to bind this control to the PdfViewer on this link to github SDK example. The PercentComboBox control may be seen as well in our FirstLook online demo.

    I hope this is helpful. If you have any additional questions or concerns please do not hesitate to contact us again.

    Regards,
    Deyan
    the Telerik team
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 04 Nov 2014 in reply to Deyan Link to this post

    Hi Deyan,

    the problem is in my UserControl I don't have any control which offer a scaling value, my usercontrol have the contract to only display a document and I expose multiple public functions to manipulate the pdfdocument. The application itself doesn't know that my usercontrol use any Telerik controls so in the application, the developpers use a standard combobox and when the user change the value of the combobox, the application call my public function ScaleDocument(double pScaleValue).

    Thank's

    Alain
  5. Deyan
    Admin
    Deyan avatar
    136 posts

    Posted 06 Nov 2014 Link to this post

    Hello Alain,

    You can create ScaleFactor dependency property for your user control which internally bounds to the RadPdfViewer's ScaleFactor depencency property. This way the application can be bound to the new dependency property without having to know about Telerik's control internal existance.

    I am attaching a sample project showing how to achieve the described above. A few words about this project:
    • There is PdfViewerUserControl which has a RadPdfViewer in it.
    • In code behind of this user control a new ScaleFactor dependency property is registered. 
    • In XAML the PdfViewerUserControl's ScaleFactor property in bounded to the child RadPdfViewer's dependency property.
    • In MainWindow.xaml the user control is used and a textbox has its text property bounded to the ScaleFactor dependency property.
    • Either by holding control and scrolling with the mouse wheel, or by using the "Zoom in" and "Zoom out" buttons you may change the ScaleFactor and this results in updating the text in the textbox.

    I hope this helps. If you have any other questions or concerns do not hesitate to contact us again.

    Regards,
    Deyan
    the Telerik team
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top