0
点赞
收藏
分享

微信扫一扫

2019-3-20-win10-uwp-如何自定义-RichTextBlock-右键菜单

title

author

date

CreateTime

categories

win10 uwp 如何自定义 RichTextBlock 右键菜单

lindexi

2019-3-20 9:54:9 +0800

2019-03-20 09:49:36 +0800

Win10 UWP

默认的 RichTextBlock 的邮件菜单是包含复制和全选,如果想要自定义菜单可以添加 ContextFlyout 属性

通过下面代码可以让右击菜单自定义,请将内容替换为你需要的,触发点击事件可以通过 Click 方法

<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>

运行上面代码可以看到这个图片

代码在 github

c# - How can I change the right click menu of a RichTextBlock in UWP - Stack Overflow






举报

相关推荐

0 条评论