Is there a property or a way to stop words from being selected when i double click?
If i double click on "microsoft" in www.microsoft.com (as a hyperlink in the rtb) microsoft becomes the selected text.
Printable View
Is there a property or a way to stop words from being selected when i double click?
If i double click on "microsoft" in www.microsoft.com (as a hyperlink in the rtb) microsoft becomes the selected text.
override the doubleclick method and in the method body put some code to let the text selection equal none. You could also just handle the event rather than using override. so:
VB Code:
Private Sub ClearSelection (...) handles myRTB.ondoubleclick 'Stuff End Sub
personally I would handle the event rather than overriding the original method as it is a cleaner way to code.
Of course you can also use XAML to route the event through to your event handler and then you dont need the "handles" statement at the end of the event signature (apparently this is a more 'wpf' way of doing things but I cant actually tell you the advantages in this scenario), then if you had multiple RTBs that you wanted to apply this to then you could specify it in each one (although there is probably a way to do this with a style so you dont have to type it in each RTB declaration):
Code:<RichTextBox MouseDoubleClick="RichTextBox_MouseDoubleClick" Height="100" Width="200" />
<RichTextBox MouseDoubleClick="RichTextBox_MouseDoubleClick" Height="100" Width="200" />