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

Hide image

2 Answers 66 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Kot
Top achievements
Rank 1
Kot asked on 24 Apr 2012, 09:55 PM
Hi,

For example, I opened an image and applied an effect to it.

How can I hide the image and settings panel?
In other words, I just want to reset image editor, like no image was opened.

Edit:

Here is an example how I did it. Is this the recommended way?

public class RhResetImageEditorTool : ITool
{
    private RadImageEditor imageEditor;
    private Panel previewPanel;
 
    public bool AffectsLayout
    {
        get { return false; }
    }
 
    public void AttachUI(ToolInitInfo previewInitInfo)
    {
        this.imageEditor = previewInitInfo.ImageEditor;
        this.previewPanel = previewInitInfo.PreviewPanel;
 
        if (this.imageEditor.ToolSettingsContainer != null)
        {
            this.imageEditor.ToolSettingsContainer.Hide();
        }
 
        this.imageEditor = null;
        this.previewPanel.Children.Clear();
        this.previewPanel = null;
    }
 
    public void DetachUI()
    {
    }
 
    public IImageCommand GetCommand()
    {
        return new CropCommand();
    }
 
    public object GetContext()
    {
        return new CropCommandContext(0, 0, 0, 0);
    }
 
    public System.Windows.UIElement GetSettingsUI()
    {
        return null;
    }
 
    public bool IsDirty
    {
        get { return false; }
    }
 
    public bool IsPreviewOverlay
    {
        get { return true; }
    }
 
    public void ResetSettings()
    {
    }
}


And on button click I execute this:
imageEditor.ExecuteTool(new RhResetImageEditorTool());<br>
imageEditor.CommitTool();

2 Answers, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 27 Apr 2012, 11:52 AM
Hello,

You can reset of the image editor by setting its Image property to null. You can also hide the whole image editor control trough its Visibility property. 
If this is not what you are looking for can you please elaborate a little bit more on your scenario. Answering the following questions would be helpful:
1. Are you using the RadImageEditor or the RadImageEditorUI control.
2. Do you need the modified image that is inside the editor, before hiding it or you just need to discard it.

Please don't hesitate to contact us again if you need more help.

Kind regards,
Alex
the Telerik team

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

0
Kot
Top achievements
Rank 1
answered on 27 Apr 2012, 01:35 PM
Looks like setting image editor's Image property to null does what I need.
I tried that previously and it wasn't working. Very strange, probably Visual Studio had some issues.

Thanks.

Tags
ImageEditor
Asked by
Kot
Top achievements
Rank 1
Answers by
Alex
Telerik team
Kot
Top achievements
Rank 1
Share this question
or