Articles in this section
Category / Section

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

2 mins read

The Syncfusion .NET MAUI Image Editor (SfImageEditor) provides support to save editing on the back button press. The following demonstration helps you to understand how to save editing on the back button press using ToolbarItemSelected event handler.

XAML:

Initialize the ImageEditor control.

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

C#:

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

this.imageEditor.ToolbarItemSelected += OnToolbarItemSelected;

C#:

In the OnToolbarItemSelected method, check whether the toolbar item Name property with “Back” and call the SaveEdits method. This suggests that the changes made in the image editor will be saved when the “Back” toolbar button is clicked.

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

Output:

SaveEdits on back button press (Crop).

BackButton_SaveEdits.gif

SaveEdits on back button press (Shape).

BackButton_ShapeSaveEdits.gif

View the sample on 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 ImageEditor’s feature tour page for other groundbreaking feature representations. You can also explore our .NET MAUI ImageEditor 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 clarifications. 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