Articles in this section
Category / Section

How to change pen annotation default color in the .NET MAUI Image Editor?

2 mins read

In the Syncfusion® .NET MAUI ImageEditor control, you can customize the default color of the pen annotation.

Initialize the SfImageEditor control, provide the source image through the Source property, and trigger the AnnotationSelected event.

XAML:

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

In the OnAnnotationSelected event, you can modify the default color of the pen with the help of the Color property in the ImageEditorShapeSettings. Refer to the below code sample for better understanding.

C#:

private void OnAnnotationSelected(object sender, AnnotationSelectedEventArgs e)
{
   if (e.AnnotationSettings is ImageEditorShapeSettings shapeSettings)
   {
       shapeSettings.Color = Colors.CadetBlue;
   }
}

Download the complete sample from GitHub.

Output:

MAUI_ImageEditor_PenAnnotation.gif

Conclusion:
I hope you enjoyed learning how to change the pen annotation default color in the .NET MAUI Image Editor.

You can refer to our .NET MAUI Image Editor feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI Image Editor documentation to understand how to present and manipulate data.

You can check out our .NET MAUI from the License and Downloads page for current customers. 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 comments section below if you have any queries or require clarification. You can also 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