Articles in this section
Category / Section

How to Save Editing on Back Button Press in the .NET MAUI Image Editor (SfImageEditor)

2 mins read

The Syncfusion® .NET MAUI Image Editor (SfImageEditor) provides support for saving edits when the back button is pressed. This demonstration helps you understand how to implement this functionality using the ToolbarItemSelected event handler.

XAML:

Initialize the Image Editor control.

<imageEditor:SfImageEditor x:Name="imageEditor" Source="image.png"/>

C#:

Attach the ToolbarItemSelected event handler and subscribe the OnToolbarItemSelected method to the event.

this.imageEditor.ToolbarItemSelected += OnToolbarItemSelected;

C#:

In the OnToolbarItemSelected method, check the toolbar item’s Name property for “Back” and call the SaveEdits method to save changes when the “Back” button is clicked.

private void OnToolbarItemSelected(object sender, ToolbarItemSelectedEventArgs e)
{
   if (e.ToolbarItem != null && e.ToolbarItem.Name.Equals("Back", StringComparison.InvariantCultureIgnoreCase))
   {
       imageEditor.SaveEdits();
   }
}

Output:

Save edits on back button press (Crop).

BackButton_SaveEdits.gif

Save edits on back button press (Shape).

BackButton_ShapeSaveEdits.gif

Download the complete sample from GitHub.

Conclusion:

I hope you enjoyed learning how to save editing on the back button press in the .NET MAUI Image Editor (SfImageEditor).

Refer to our .NET MAUI Image Editor feature tour page for other groundbreaking feature representations. You can also explore our .NET MAUI Image Editor documentation to understand how to present and manipulate data.

For current customers, check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Image Editor and other .NET MAUI components.

Please let us know in the following comment section if you have any queries or require clarification. Contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied