Open atiyka opened 3 years ago
Hello atiyka, thank you for opening an issue with us!
I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌
This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.
This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.
FYI @marb2000
This issue still exists in the latest version of Windows 11 and it occurs with the context menu of Textboxes as well - the issue actually occurs in some preinstalled Windows apps as well such as Paint and Notepad, which both now use WinUI 2. Additionally, it seems to occur with UWP apps that use AppWindows as well. It might be worth reporting it here: https://github.com/microsoft/microsoft-ui-xaml.
Describe the bug
In a
WPF
application (targeting.NET Core 3.1
) I'm usingXamlHosts
to display windows 10 design UI elements. I'm using theUWP RichEditBox
to allow the user to enter rich text. It's possible to open multiple windows inside my app, and each window contains a RichEditBox.My first issue is that if I select a text inside the RichEditBox, a "small" context menu appears, where I can style the text (Bold, Italic and Underline). If I open the next window and select a text, the mentioned context menu will appear at the position of the previous window. (See the image below)
Steps to Reproduce
This can be easily reproduced by taking the xaml-islands sample and duplicating the island component with the following code (in WPF's
MainWindow.xaml
):The other and bigger problem is that if I close the window, which was first open and where the little context menu always appears and then try to select some text on another window, the app crashes with the following exception:
This happens because it can't display the context menu, since the first window was disposed.
What I tried:
TextWrapping = "NoWrap"
, but doesn't help.ContextMenuOpening
event, by settinge.Handled = true
. This completely disables the context menus, the bigger context menu is also disabled (as I right click on the selected text)ContextMenuOpening
event is called before theRightTapped
event, so I can't know when the user right tapped and then allow the context menu to display.Expected behavior
I would like to see the context menu where I select the text, or press the right button, not in another RichEditBox.
Screenshots
Environment