在下面的XAML中,我将InkCanvas放在RichTextBox控件之上。在MVVM风格中,有没有办法用鼠标事件返回底层的RichTextBox对象? (这样可以获取RichTextBox中的鼠标位置和最近的单词)。
感谢您的任何帮助或想法。
<UserControl x:Class="Nova5.UI.Views.Ink.InkRichTextView"
.....
<Grid>
<f:SimpleRichTextBox Name="simplerichtextbox"
RichText="{Binding RichText, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}"
>
<FlowDocument PageWidth="{Binding ElementName=simplerichtextbox, Path=ActualWidth}" />
</fsc:SimpleRichTextBox>
<InkCanvas
Height="{Binding ElementName=simplerichtextbox, Path=ActualHeight}"
Width="{Binding ElementName=simplerichtextbox, Path=ActualWidth}"
Background="Transparent"
DefaultDrawingAttributes="{Binding Pen}"
EditingMode="{Binding EditingMode}"
Strokes="{Binding Strokes}"
h:MouseBehaviour.MouseUpCommand="{Binding MouseUpCommand}"
h:MouseBehaviour.PreviewMouseDownCommand="{Binding PreviewMouseDownCommand}"/>
</Grid>
</UserControl>