FlowDocumentReader 中的上下文菜单
ContextMenu in FlowDocumentReader
ContextMenu 适用于 TextBox 和 FlowDocumentScrollViewer。
ContextMenu 在 FlowDocumentReader 中不起作用。
我刚刚获得 FlowDocumentReader 的默认值。
如何在 FlowDocumentReader 中获取 ContextMenu?
<TextBox Grid.Row="0">
<TextBox.ContextMenu>
<ContextMenu>
<MenuItem Command="Cut"/>
<MenuItem Command="Copy"/>
<MenuItem Command="Paste"/>
<MenuItem Header="NewItem"/>
</ContextMenu>
</TextBox.ContextMenu>
Some text
</TextBox>
<FlowDocumentReader Grid.Row="1">
<FlowDocumentReader.ContextMenu>
<ContextMenu>
<MenuItem Command="Copy"/>
<MenuItem Command="SelectAll"/>
<MenuItem Header="NewItem"/>
</ContextMenu>
</FlowDocumentReader.ContextMenu>
<FlowDocument>
<Paragraph>some text</Paragraph>
</FlowDocument>
</FlowDocumentReader>
<FlowDocumentScrollViewer Grid.Row="2">
<FlowDocumentScrollViewer.ContextMenu>
<ContextMenu>
<MenuItem Command="Copy"/>
<MenuItem Command="SelectAll"/>
<MenuItem Header="New Item"/>
</ContextMenu>
</FlowDocumentScrollViewer.ContextMenu>
<FlowDocument>
<Paragraph>some text</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
解决方案是将 ContextMenu 放在 FlowDocument 上
<FlowDocumentReader Grid.Row="1">
<FlowDocument>
<FlowDocument.ContextMenu>
<ContextMenu>
<MenuItem Command="Copy"/>
<MenuItem Command="SelectAll"/>
<MenuItem Header="NewItem"/>
</ContextMenu>
</FlowDocument.ContextMenu>
<Paragraph>some text</Paragraph>
</FlowDocument>
</FlowDocumentReader>
ContextMenu 适用于 TextBox 和 FlowDocumentScrollViewer。
ContextMenu 在 FlowDocumentReader 中不起作用。
我刚刚获得 FlowDocumentReader 的默认值。
如何在 FlowDocumentReader 中获取 ContextMenu?
<TextBox Grid.Row="0">
<TextBox.ContextMenu>
<ContextMenu>
<MenuItem Command="Cut"/>
<MenuItem Command="Copy"/>
<MenuItem Command="Paste"/>
<MenuItem Header="NewItem"/>
</ContextMenu>
</TextBox.ContextMenu>
Some text
</TextBox>
<FlowDocumentReader Grid.Row="1">
<FlowDocumentReader.ContextMenu>
<ContextMenu>
<MenuItem Command="Copy"/>
<MenuItem Command="SelectAll"/>
<MenuItem Header="NewItem"/>
</ContextMenu>
</FlowDocumentReader.ContextMenu>
<FlowDocument>
<Paragraph>some text</Paragraph>
</FlowDocument>
</FlowDocumentReader>
<FlowDocumentScrollViewer Grid.Row="2">
<FlowDocumentScrollViewer.ContextMenu>
<ContextMenu>
<MenuItem Command="Copy"/>
<MenuItem Command="SelectAll"/>
<MenuItem Header="New Item"/>
</ContextMenu>
</FlowDocumentScrollViewer.ContextMenu>
<FlowDocument>
<Paragraph>some text</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
解决方案是将 ContextMenu 放在 FlowDocument 上
<FlowDocumentReader Grid.Row="1">
<FlowDocument>
<FlowDocument.ContextMenu>
<ContextMenu>
<MenuItem Command="Copy"/>
<MenuItem Command="SelectAll"/>
<MenuItem Header="NewItem"/>
</ContextMenu>
</FlowDocument.ContextMenu>
<Paragraph>some text</Paragraph>
</FlowDocument>
</FlowDocumentReader>