0

我将我的 PDFDocument 绑定到 FlowDocumentScrollViewer。

        <FlowDocumentScrollViewer
            Document="{Binding Path=PDFDocument}"                   
            />

如何将新的上下文菜单项添加到查看区域内的文本框中

在此处输入图像描述

4

1 回答 1

0

最终我找到了如何做到这一点您可以使用这样的样式属性设置器将上下文菜单附加到每个 TextBox 元素:

<Window.Resources>
    <ContextMenu x:Key="contextMenu" >
        <MenuItem Name="mnuOpen" Header="_Open Link"  Command="{Binding TextBoxContextMenuCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"/>
        <MenuItem Name="mnuView" Header="_View Properties" Command="{Binding TextBoxContextMenuCommand}"/>
    </ContextMenu>
    <Style TargetType="TextBox">
        <Setter Property="ContextMenu" Value="{DynamicResource contextMenu}" />
    </Style>
</Window.Resources>
于 2019-03-13T12:59:50.087 回答