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

Get cursor/caret position/information

Hi there,

I'm continuing development of my application to annotate to documents in WinRT. We need to be able to access the current cursor position so that we can record the point that a comment can be inserted and then later amend the source document to insert the actual comment.

I understand that the RichTextBoxAdv control doesn't handle the input and displaying of comments and this is fine, I simply need to be able to hold some information about the current cursor position from where the user has tapped or clicked on the document. Ideally page, paragraph, section, word or character, but anything would be better than nothing.

Any help that you can provide would be greatly appreciated,

Thanks,

Kurt


5 Replies

AP Arumuga Perumal S Syncfusion Team June 12, 2014 01:36 PM UTC

Hi Kurt,

Thank you for your interest in Syncfusion products.

In our SfRichTextBoxAdv control , it is possible to obtain the current cursor position and current paragraph whenever we tapped or clicked on the document by hooking the SelectionChanged event. We have mentioned the sample code snippet for the same below.

Hooking selection changed event of SfRichTextBoxAdv control:
richtextbox.SelectionChanged += richtextbox_SelectionChanged;

Retrieving current cursor position:
void richtextbox_SelectionChanged(object obj, Syncfusion.UI.Xaml.RichTextBoxAdv.SelectionChangedEventArgs args)

{

     TextPosition position = richtextbox.Selection.Start;

     ParagraphAdv paragraph = position.Paragraph;

}


Please let us know if you have any other questions.

Regards,
Arumuga Perumal S.



KF Kurt Farrar June 12, 2014 01:42 PM UTC

Many thanks for your speedy reply. Is that event new to v12 of the controls?

I'm currently running v11.3.x and don't see it.



AP Arumuga Perumal S Syncfusion Team June 13, 2014 03:44 AM UTC

Hi Kurt,

Thank you for your update.

Yes, the SelectionChanged event is available from Essential studio v12.1 and is available for download under the following link.

http://www.syncfusion.com/support/forums/announcements/116142.

Please let us know if you have any other questions.

Regards,
Arumuga Perumal S.



KF Kurt Farrar June 13, 2014 07:43 AM UTC

Thanks, I got a trial of the latest version to check myself yesterday, and have bought the latest version of the controls since.


AP Arumuga Perumal S Syncfusion Team June 13, 2014 09:32 AM UTC

Hi Kurt,

Thank you for your update.

Please let us know if you have any other questions.

Regards,
Arumuga Perumal S.


Loader.
Live Chat Icon For mobile
Up arrow icon