How to show or hide Image Editor toolbar items?
SfImageEditor allows you to enable or disable the items in toolbar
Step 1: Create image editor sample with all necessary assemblies.
Please refer the below link to create a simple SfImageEditor sample along with the ways to configure it.
https://help.syncfusion.com/xamarin/sfimageeditor/getting-started
Step 2: SetToolbarItemVisibility method is used to hide/show items in toolbar. Specify the name of the item in SetToolbarItemVisibility method as arguments, and set visibility value as true/false.
The following code snippet illustrates the way to this method,
Xaml:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:ImageEditor_GettingStarted" xmlns:editor="clr- namespace:Syncfusion.SfImageEditor.XForms;assembly=Syncfusion.SfImageEditor.XForms" x:Class="ImageEditor_GettingStarted.MainPage"> <Grid> <editor:SfImageEditor Source="{Binding Image}" x:Name="imageeditor"> </editor:SfImageEditor> </Grid>
C#
public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); BindingContext = new ImageModel(); Editor.SetToolbarItemVisibility("redo,undo,text,path", false); } }
You can also specify the single item or multiple items in SetToolbarItemVisibility method as arguments.
Code snippet
Editor.SetToolbarItemVisibility("redo", false);
Note:
The list of items in toolbar that can be hidden/shown by using SetToolbarItemVisibility method are follows.
text, redo, undo, save, transform, rotate, shape, crop, path, circle, reset, and arrow
Sample link:
Screenshot: