wpf - Detect Entering a Text between two TextPointer s in RichTextBox -
i have richtextbox in wpf program. imagine have 2 textpointers indicating first , lastly of part of rtb. how can know if entered text in between these 2 pointers or not ?
//i have values of these 3 pointer.imagine filled private bool isbetween(textpointer first,textpointer last,textpointer current){ //i don't know how write function }
in above code first
, last
indicate area ! , want function tell me if current
between these 2 textpointers or not ?
try:
private bool isbetween(textpointer first,textpointer last,textpointer current) { bool isafterfirst = first.getoffsettoposition(current) >= 0; bool isbeforelast = last.getoffsettoposition(current) <= 0; homecoming isafterfirst && isbeforelast; }
add null checks see appropriate...
based on: msdn : getoffsettoposition
wpf richtextbox
No comments:
Post a Comment