c# - How can I move the cursor to the end of the text in RichEditBox? -


i'm building windows phone 8.1/windows 8.1 app (winrt) , i'm using richeditbox control. every time add text it, cursor goes beginning of text , can't find way move end of text.

i've build 2 methods set , add text:

public static void settext(this richeditbox e, string text) {     e.document.settext(windows.ui.text.textsetoptions.none, text);  }  public static string gettext(this richeditbox e) {    string value;    e.document.gettext(windows.ui.text.textgetoptions.adjustcrlf, out value);     return  value;  } 

and i'm using code add text it:

statusbox.settext(statusbox.gettext() +                                   texttoadd); 

now, how can move cursor end of text?

by manipulating selection property in document property of richeditbox

var newpos = statusbox.gettext().length-1; statusbox.document.selection.setrange(newpos,newpos) statusbox.focus(focusstate.keyboard); 

Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -