Getting selected text from a RichTextBox only on MouseUp?
I'm a newbe to RichTextBox and unable to find the answer. In a RichTextBox (WPF) that is already holding text content, I would like to be able to place the cursor down on one letter; move the cursor horizontally while holding it down; then lift the cursor up. This results in the text being highlighted and selected. So far so good.
However, in the following XAML, the selection event is triggered for every character. I only want one firing for when the mouse is lifted off the box and ultimately would like to know the starting and ending insertion points for the selected text as well as the selected text. (I know this is simple, but I can't get it :( ).
XAML
<SimpleRichTextBox Name="simplerichtextbox" Grid.Column="1"
RichText="{Binding RichText, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}"
SelectionChanged="simplerichtextbox_SelectionChanged"
>
<FlowDocument PageWidth="{Binding ElementName=simplerichtextbox, Path=ActualWidth}" />
<SimpleRichTextBox>
Any help is much appreciated.
链接地址: http://www.djcxy.com/p/61132.html