Event when image is loaded

2 posts, 0 answers
  1. MNP
    MNP avatar
    40 posts
    Member since:
    Apr 2008

    Posted 11 Aug 2011 Link to this post

    I'm trying to automatically select the crop tool when an image is loaded. All is ok if I preload the image, but if I allow the user to select the image, I can't seem to find the event that is called after I load up the image to load the tool.

    It's probably right in front of me.

    Thanks

    -Matt
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 15 Aug 2011 Link to this post

    Hello Matt,

    Thank you for this feature suggestion. We will be introducing more convenient events in the upcoming service pack, which will enable you to track when a command is executed, be it the OpenImageCommand or any other. 
    With the current version of the controls, you can find out when a new image has been loaded in the control by subscribing to the CurrentImageChanged event of the History property in the following way:

    this.ImageEditorUI.ImageEditor.History.CurrentImageChanged += History_CurrentImageChanged;
    Then, you have to check if you can undo/redo, because the CurrentImageChanged is also fired when you commit a command, e.g. you crop the picture or change its size.
    Here is a sample code-snippet that determines if a new image has been loaded in the control:
    void History_CurrentImageChanged(object sender, EventArgs e)
    {
        ImageHistory history = (ImageHistory)sender;
        if (!history.CanRedo && !history.CanUndo)
        {
            MessageBox.Show("Image changed!");
        }
    }
    Best wishes,
    Iva
    the Telerik team

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

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top