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

default the Zoom to Auto

1 Answer 154 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 20 Oct 2011, 04:38 PM
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%?

Thanks
Steve

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 24 Oct 2011, 08:19 PM
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()
{
    InitializeComponent();
    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 >>

Tags
ImageEditor
Asked by
Steve
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or