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

Image Orientation Issue: RadImageEditorUI

1 Answer 196 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
em
Top achievements
Rank 1
em asked on 30 Jun 2017, 05:08 PM

The image I'm working on has some metadata because of which the landscape photo is displayed portrayed. User can rotate once loaded, but what I'm trying to achieve is load the image with proper orientation in first place. I have tested my C# code to read the metadata orientation of image and correct it accordingly to load it properly in normal WPF image control. But I'm having problem using the same code in the Telerik RadImageEditorUI. Basically, I'm looking for an event that could be raised when user selects open>select image from radImageEditorUI dialog box, which then I can use to handle the orientation handling code. 

So, my question is, is there something in Telerik RadImageEditorUI that can handle the orientation issue when loading image? or Is there some kind of image loading or image selected event raised?

    

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 05 Jul 2017, 11:29 AM
Hello em,

To achieve the desired result, you can handle the CommandExecuted event of the RadImageEditor and rotate the image if the command is of type OpenImageCommand. Here's what I have in mind:

private void ImageEditorUI_ImageEditorLoaded(object sender, EventArgs e)
{
    var editorUi = sender as RadImageEditorUI;
    editorUi.ImageEditor.CommandExecuted += ImageEditor_CommandExecuted;
}
 
private void ImageEditor_CommandExecuted(object sender, Telerik.Windows.Media.Imaging.ImageEditorCommands.ImageCommandExecutedEventArgs e)
{
    var editor = sender as RadImageEditor;
    if (e.Command is OpenImageCommand)
    {
        editor.Rotate(90);
    }
}

Please let me know whether such an approach would work for you.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ImageEditor
Asked by
em
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or