![](/img/trans.png)
[英]How do I disable the context menu of FlowDocumentScrollViewer, FlowDocumentPageViewer, or FlowDocumentReader?
[英]How can I add context menu item to a textBox inside of the FlowDocumentScrollViewer
最終,我找到了解決方法。您可以使用如下樣式屬性設置器將上下文菜單附加到每個TextBox Elements:
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.