default the Zoom to Auto

2 posts, 0 answers
  1. Steve
    Steve avatar
    2 posts
    Member since:
    Jul 2011

    Posted 20 Oct 2011 Link to this post

    when an image loads up, the ImageEditorUI shows a drop down in the lower right hand corner starting at 100% and you can change the zoom of the image by selecting a different 10% , 50%, auto .. etc.

    I would like to default that drop down to "Auto" instead of 100%?


  2. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 24 Oct 2011 Link to this post

    Hello Steve,

    You have confirmed that the following approach works OK in the support ticket you opened, but I will post it here for other developers who wonder how this can be done.

    In order to have the image shown in Auto size, you need to set the ScaleFactor property of RadImageEditor to 0. This can only be done after the ImageEditor has been loaded and an Image has been opened in the editor. The following snippet shows how this can be done:

    public MainPage()
        this.ImageEditorUI.ImageEditorLoaded += new EventHandler(ImageEditorUI_ImageEditorLoaded);
    void ImageEditorUI_ImageEditorLoaded(object sender, EventArgs e)
        this.ImageEditorUI.ImageEditor.History.CurrentImageChanged += new EventHandler(History_CurrentImageChanged);
    void History_CurrentImageChanged(object sender, EventArgs e)
        if (this.ImageEditorUI.Image != null)
            this.ImageEditorUI.ImageEditor.ScaleFactor = 0;

    The code from the snippet works for versions of the controls after Q2 SP1 (2011.2.920), i.e. in order to achieve the Auto scaling, you should download an internal build or the recently released Q3 Beta (2011.3.1020).
    More information on the History property of the editor can be found here.

    Kind regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft R3 2016 release webinar banner
Back to Top