Hide image

3 posts, 0 answers
  1. Kot
    Kot avatar
    7 posts
    Member since:
    Aug 2010

    Posted 24 Apr 2012 Link to this post

    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. Alex
    Admin
    Alex avatar
    129 posts

    Posted 27 Apr 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Kot
    Kot avatar
    7 posts
    Member since:
    Aug 2010

    Posted 27 Apr 2012 Link to this post

    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.

Back to Top