Events in the .NET MAUI Image Editor (SfImageEditor)

17 Oct 20253 minutes to read

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

Annotations deserialized event

This AnnotationsDeserialized event occurs when the annotations are deserialized onto the image.

NOTE

Serialization and deserialization are not applicable for custom annotation views.

<imageEditor:SfImageEditor x:Name="imageEditor" 
                           Source="image.png" 
                           AnnotationsDeserialized="OnAnnotationsDeserialized"/>
private async void OnAnnotationsDeserialized(object? sender, EventArgs e)
{
    await DisplayAlert("", "Annotations are deserialized", "Ok");
}

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