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

posted @ 2019-11-21 16:10  lindexi  阅读(85)  评论(0编辑  收藏  举报