Articles in this section
Category / Section

How to update color, stroke thickness for selected shape programmatically in the .NET MAUI Image Editor?

2 mins read

The Syncfusion® .NET MAUI Image Editor allows you to programmatically customize the color and stroke thickness of selected shapes. This guide demonstrates how to achieve this customization when shapes are selected.

XAML:

Initialize the Image Editor Control and provide the source image.

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

C#:

Trigger the AnnotationSelected event to customize the shape.

imageEditor.AnnotationSelected += OnAnnotationSelected;

C#:

Using the properties of ImageEditorShapeSettings, you can customize the shape.

private void OnAnnotationSelected(object sender, AnnotationSelectedEventArgs e)
{
   if (e.AnnotationSettings is ImageEditorShapeSettings shapeSettings)
   {
       shapeSettings.Color = Colors.Black; // Set the desired color
       shapeSettings.StrokeThickness = 10; // Set the desired stroke thickness
   }
}

Output:

Customize_ShapeColor.png

Conclusion:

I hope you enjoyed learning how to programmatically update the color and stroke thickness for the selected shapes in the .NET MAUI Image Editor.

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