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

RadImageEditorUI ResizeTool Change Detection

4 Answers 94 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Laszlo
Top achievements
Rank 1
Laszlo asked on 27 Mar 2013, 08:03 PM
Hi,

I have a problem similar to this: Change Detection , and it seems to me that this is a bug in the RadImageEditorUI control.
When I use my own save command:

void radImageEditorUI_ImageEditorLoaded(object sender, EventArgs e)
{
    radImageEditorUI.ImageEditor.History.CurrentImageChanged +=
          (_s, _e) => { Console.WriteLine(123); };
    radImageEditorUI.SaveCommand = NewSaveCommand;
    radImageEditorUI.ImageEditor.CommandExecuted += (ImageEditor_CommandExecuted);
}

(For me, my Save Button is always enabled.)

When I click on "Resize", the CommandExecuted event hits, I change the size and click Save Button, than it saves with the default size. (This is wrong!)
But if I clik on "Resize" again, CurrentImageChanged event hits, and than Save Button saves with the new size.

Is there a workaround for this?
I use version 2012.3.1016.0

And one more thing:
On Resize panel, there is an indicator showing the estimated size of the image. 
Which image type (png, bmp) is this estimation based on? I have my own SaveCommand with other image types (pdf, jpg), and this size extimation confuses me and users.
How can I disable it? 

I also posted this in the fotum: RadImageEditorUI ResizeTool Change Detection

Thanks,
L

4 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 29 Mar 2013, 02:25 PM
Hello Laszlo,

The behavior you are observing is not a bug, but is by design. As explained in the forum thread you referenced and as you found in your application, a change in the image, or in other words - commit of the current tool, only happens after you click on a tool to invoke it. It makes no difference if the same (in this case the Resize tool) or another one is clicked, but it is a required step for the changes to take effect and it has no workaround.

Regarding the Image Size that is shown - the estimate represents the raw data. i.e. in case each pixel is 4b, how big is the image. As the available export formats compress the image, it does not actually represent the size when you save to any of them.

What you can do in order to disable it is change the template, for example collapse the label in the tool settings. We will also consider a change in this regard for one of our future releases.

I hope this helps! Let us know if you have other questions.

All the best,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Laszlo
Top achievements
Rank 1
answered on 01 Apr 2013, 12:53 AM
Hello Petya,

thanks for your answer.

You say, there is no workaround. But there shold be one, because on Telerik's demo page (http://demos.telerik.com/silverlight/) when I resize the image and click Save, the resized image is saved. I do not need to click on another tool to invoke/commit the changes. What is the difference that makes my application behave differently? Is it that I use my own SaveCommand? 
ResizeToolSettings shows some details about the "uncommitted" image, but I can't reach this image itself.

About the image size estimate: I can see in ResizeToolSettings' definition the TemplateParts, but how can I modify the template? I can't find a way to extract the template in xaml, or somehow get it modified in code-behind. My goal is to hide this size estimation.

Best,
L
0
Accepted
Petya
Telerik team
answered on 03 Apr 2013, 04:43 PM
Hi Laszlo,

Please excuse me for the misunderstanding.

I do not know how you've implemented your save command and whether you've based it on the default one, but the default save command calls the CommitTool () method in its ExecuteOverride in order to commit the current tool before exporting. You should probably adopt a similar approach in your application too 

I am also attaching a project where the templates of the ResizeToolSettings and CanvasResizeToolSettings have been extracted, along with the needed brushes (in the default Office Black theme) and modified so to collapse the size estimation. I hope it is helpful!

Let us know if there is anything else.
 
Kind regards,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Laszlo
Top achievements
Rank 1
answered on 05 Apr 2013, 12:39 PM
Hi Petya,

thank you for your answer, it was really helpful.

Yes, the CommitTool() was missing from my implementation of ExecuteCommand. I'm not sure where from I should have known to include it. But it works now, thanks.

And also thank you for the templates. I was not able to extract them by myself.
However, your solution was still not enough: I had to programmatically set tools' styles in ImageEditor_CommandExecuted event.

Best,
Laszlo
Tags
ImageEditor
Asked by
Laszlo
Top achievements
Rank 1
Answers by
Petya
Telerik team
Laszlo
Top achievements
Rank 1
Share this question
or