We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to load the image annotated with shapes and text on the image editor.

Platform: WPF |
Control: SfImageEditor

This section explains how to annotate the image with shapes (Circle, Rectangle, Arrow, Path) and text programmatically on loading itself.

To add shape / text on loading the image,  you need to invoke the ImageLoaded event as shown in the below snippet.

XAML

  <editor:SfImageEditor x:Name="editor" 
                              ImageLoaded="SfImageEditor_Loaded" ImageSource="Assets\RoadView.jpeg">           
        </editor:SfImageEditor>     

 

Add the required shapes or text along with its customization such as color, stroke and its position either using PenSettings or TextSettings in the loaded event a shown in the below code.

C#

        /// <summary>
        /// Invoked when the image in the <see cref="SfImageEditor"/> is loaded.
        /// </summary>
        /// <param name="sender">Image editor</param>
        /// <param name="e">event arguments</param>
        private void SfImageEditor_Loaded(object sender, ImageLoadedEventArgs e)
        {
            editor.AddShape(ShapeType.Circle, new PenSettings()
            {
                Bounds = new Rect(10, 15, 20, 20),
                Stroke = new SolidColorBrush(Colors.BlueViolet)
            });
 
            editor.AddText("Good Morning", new TextSettings()
            {
                FontFamily = new FontFamily("Consolas"),
                TextEffects = TextEffects.Italic,
                Bounds = new Rect(45, 30, 25, 25),
            });
        }

 

Screenshot: Annotated image

Sample for loading shape and text on the image can be referred here.

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile