Category / Section
How to change colors in toolbar menu?
1 min read
SfImageEditor allows you to change the colors in toolbar menu.
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: Customize the colors in toolbar by using ColorPalette property. You can also add or remove the existing colors in toolbar.
Xaml:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace: ImageEditor_GettingStarted" x:Class="EditorSample.MainPage" xmlns:editor="clr-namespace:Syncfusion.SfImageEditor.XForms;assembly=Syncfusion.SfImageEditor.XForms"> <Grid> <editor:SfImageEditor Source="{Binding Image}" x:Name="imageeditor"> <editor:SfImageEditor.ColorPalette> <Color>Aqua</Color> <Color>Sienna</Color> <Color>Purple</Color> </editor:SfImageEditor.ColorPalette> </editor:SfImageEditor> </Grid> </ContentPage>
Please refer the following code snippet to create a collection of colors,
C#
ObservableCollection<Color> color = new ObservableCollection<Color> { Color.Aqua, Color.Sienna, Color.Purple };
In the below code snippet, created observable collection of colors has been set to Colorpalete property.
C#
public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); BindingContext = new ImageModel(); ObservableCollection<Color> color = new ObservableCollection<Color> { Color.Aqua, Color.Sienna, Color.Purple }; imageeditor.ColorPalette = color; } }
Sample link:
Screenshot: