2019-3-20-UWP-How-to-custom-RichTextBlock-right-click-menu

Posted lonelyxmas

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2019-3-20-UWP-How-to-custom-RichTextBlock-right-click-menu相关的知识,希望对你有一定的参考价值。

原文:2019-3-20-UWP-How-to-custom-RichTextBlock-right-click-menu

title author date CreateTime categories
UWP How to custom RichTextBlock right click menu
lindexi
2019-03-20 09:54:54 +0800
2019-3-20 9:46:7 +0800
UWP

We can find the default RichTextBlock will show the copy and the select all menu when we right click it. If you think the default menu is too boring, try customizing the RichTextBlock right click menu.

We can use ContextFlyout to custom RichTextBlock right click 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>

Run the code and you can see this image.

技术图片

All code is in github

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

以上是关于2019-3-20-UWP-How-to-custom-RichTextBlock-right-click-menu的主要内容,如果未能解决你的问题,请参考以下文章