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

Read in the value of text entered in an SfImageEditor on the fly

I currently have a Page with an SfImageEditor and when I add a textbox to the image in the SfImageEditor, I want a way to read in what I type into that text box so I can either store that value in my database or paste that text in a read-only Xamarin.Forms Entry view below the SfImageEditor...can you please help me by providing a sample solution to do this.

Thank you,

3 Replies

RA Rachel A Syncfusion Team November 13, 2019 05:51 AM UTC

Hi Madhu, 
Greetings from Syncfusion. 
We can get the entered text from the text box in selected state using SelectedItemName argument in ItemSelected event. Find the code snippet below to achieve it. 
     imageEditor.ItemSelected += ImageEditor_ItemSelected; 
      private void ImageEditor_ItemSelected(object sender, ItemSelectedEventArgs args)
            var Settings = args.Settings;

            if (Settings is TextSettings)
                string text = args.SelectedItemName;
Please let us know if you have any concerns. 

MG Madhu Ganesh November 14, 2019 12:41 AM UTC

Thank you Rachel. I tried out the provided solution and it works when I add a text box to the image editor as follows

imgEditor.AddText("Enter Text", new TextSettings());

The label below the editor shows the string "Enter Text" which is what I want.

When I click on the "Enter Text" text box, a dialog pops up where I can change the text so I change it to "ABC" and hit OK. But this new value does not get reflected in the Label below the SfImageEditor. How can I fix this?

I have to click someplace else on the image and then click the textbox again for the new text "ABC" to get reflected on the label...

Would I be able to use data binding to solve this problem or is there another way?

Thank you,

RA Rachel A Syncfusion Team November 14, 2019 01:49 PM UTC

Hi Madhu, 
We are currently having support to get the edited text when the text box is in selected stated using ItemSelected event in SfImageEditor. Also, there is no feasibility to get the edited text in sample level when changing it dynamically.  

Live Chat Icon For mobile
Up arrow icon