i have two richtextboxes one below the other in my application.when the user start selection in one richtextbox and continue to the other richtextbox selection should automatically move to the second richtextbox.is there any way to do this type of selection.
thanks in advance,
dhyanesh
You’d think you could use
MouseEnterandMouseLeave, but when the mouse is captured (as it is during text selection), these events don’t fire as expected.The way to achieve your goal is:
MouseMoveon the first RichTextBox.MouseMoveevent, checkMouse.Capturedto see if it is the RichTextBox.VisualTreeHelper.HitTest. Go up the visual tree from the value ofHitTestResult.VisualHitto see if the mouse is over a RichTextBox other than the current one.Mouse.Capture(null), then fire aMouseLeftButtonDownevent on the new RichTextBox to cause it to capture the mouse and begin selection.