[英]How can I change the Right-Click menu of a RichTextBlock in UWP
I want to override the right-click menu in a RichTextBlock
or a TextBlock
, I have been searching for the solution and tried using RightTappedEvent
, but it did not fire when right tapped a chosen text, but it fired when I right tapped in elsewhere in the control. 我想覆盖
RichTextBlock
或TextBlock
的右键单击菜单,我一直在寻找解决方案,并尝试使用RightTappedEvent
,但是右键单击选定的文本并不会触发,但是当我在右侧的其他位置右击时会触发控制。
Yes, you can use ContextFlyout
to change it. 是的,您可以使用
ContextFlyout
进行更改。
You can add the ContextFlyout
to custom your menu. 您可以添加
ContextFlyout
以自定义菜单。
The code shows how to add the custom menu. 该代码显示了如何添加自定义菜单。
<RichTextBlock HorizontalAlignment="Center" VerticalAlignment="Center">
<RichTextBlock.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Text="1" />
<MenuFlyoutItem Text="2" />
</MenuFlyout>
</RichTextBlock.ContextFlyout>
<Paragraph>Welcome to my blog http://blog.lindexi.com I write some UWP blogs</Paragraph>
</RichTextBlock>
See UWP How to custom RichTextBlock right click menu 请参见UWP如何自定义RichTextBlock右键菜单
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.