Issue: Unexpected Keyboard Behavior with WPF RichTextBox and Visual Studio
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/Issue:-Unexpected-Keyboard-Behavior-with/10793784)._
---
[severity:It bothers me. A fix would be nice]
When working with a WPF application containing a RichTextBox control, we are experiencing a strange behavior involving keyboard input. If the user types text into the RichTextBox and then presses the backspace or delete key, the expected behavior is for the text in the RichTextBox to be deleted.
However, when a file is open and highlighted in Visual Studio behind the application window, pressing backspace or delete deletes text from the file in Visual Studio, rather than from the RichTextBox in the WPF application. This issue only occurs when the file in Visual Studio is focused, and the WPF window is in the foreground.
Steps to Reproduce:
Open a WPF application containing a RichTextBox.
Type text into the RichTextBox.
Open a file in Visual Studio and highlight some text in the file.
Click on the WPF window with the RichTextBox to focus it, and type text.
Press backspace or delete.
Observe that the text is deleted from the file in Visual Studio, not the RichTextBox in the WPF window.
Expected Behavior:
The backspace and delete keys should only affect the RichTextBox content in the WPF window, regardless of whether a file is open and highlighted in Visual Studio behind the window.
Environment:
Visual Studio Version: VS2019/VS2022
.NET Framework : 4.8
---
### Original Comments
#### Feedback Bot on 11/19/2024, 01:26 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
#### Ann Yang [MSFT] on 11/19/2024, 07:13 PM:
Thank you for your feedback!
Is this still stable to reproduce on the latest version 17.12.1 downloading from https://visualstudio.microsoft.com/downloads/?
If yes, could you attach a video of the issue you describe using [ScreenToGif] ( https://www.screentogif.com/) or a similar tool? A video can help us see the actions more directly.
We are looking forward to hearing from you soon.
Thanks
#### Rashmi H S on 11/19/2024, 09:02 PM:
(private comment, text removed)
#### Ann Yang [MSFT] on 11/19/2024, 11:05 PM:
Thanks for your reply, I used a blank WPF Framework project and target framework on 4.8, but this issue didn’t reproduce on myside, please see my screen recording.

please note, I worked in Microsoft Visual Studio Professional 2019 Version 16.11.42, Could you upgrade your VS and try again? is there a sample project for us to investigate this issue?
#### Rashmi H S on 11/20/2024, 10:11 PM:
(private comment, text removed)
#### Feedback Bot on 11/21/2024, 11:51 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
#### Rashmi H S on 11/25/2024, 09:00 PM:
(private comment, text removed)
#### Rashmi H S on 12/2/2024, 00:35 AM:
(private comment, text removed)
Contributor guide
Assessment
This issue has not been assessed yet.