Events in the .NET MAUI Image Editor (SfImageEditor)

The SfImageEditor supports the ImageLoaded and AnnotationSelected events to interact with .NET MAUI Image Editor.

Image loaded event

This ImageLoaded event will be triggered after the image has been loaded. By this event, you can add any shapes or text over an image or crop an image while initially loading the image.

<imageEditor:SfImageEditor Source="image.png" ImageLoaded = "OnImageLoaded" />
private void OnImageLoaded(object sender, EventArgs e)
    {
        this.imageEditor.Rotate();
    }

NOTE

View sample in GitHub

Annotation selected event

This AnnotationSelected event occurs when the annotation is selected.

NOTE

This is common for Shape and Text annotations.

<imageEditor:SfImageEditor Source="image.png" AnnotationSelected = "OnAnnotationSelected" />
private void OnAnnotationSelected(object sender, AnnotationSelectedEventArgs e)
    {
        if (e.AnnotationSettings is ImageEditorShapeSettings shapeSettings)
        {
            shapeSettings.Color = Colors.Black;
        }
    }

Browse image event

The BrowseImage event occurs when you click the browse icon in the toolbar while browsing the image source.
Cancel: Restrict the default image browse picker opening by setting the Cancel argument true.

<imageEditor:SfImageEditor Source="image.png" BrowseImage = "OnImageBrowse" />
private void OnImageBrowse(object sender, CancelEventArgs e)
    {
        e.Cancel = true;
    }