Articles in this section
Category / Section

How to override default save action in the .NET MAUI Image Editor?

2 mins read

The Syncfusion® .NET MAUI Image Editor (SfImageEditor) allows you to override the default save action. This guide demonstrates how to customize the save action using the ToolbarItemSelected event handler.

XAML:

Initialize the SfImageEditor 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, set the Cancel property as true to restrict the default save action and call the Save method to implement the custom save action.

private void OnToolbarItemSelected(object sender, ToolbarItemSelectedEventArgs e)
{
   if (e.ToolbarItem != null && e.ToolbarItem.Name == "Save")
   {
       e.Cancel = true;
       imageEditor.Save(ImageFileType.Png, imageSize: new Size(200, 200));
   }
}

Download the complete sample from GitHub.

Conclusion:
I hope you enjoyed learning how to override the default save action 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