WPF RestoreInputLanguage="True" does not revert to the previous language
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
Product Info
Windows/.NET Versions
.NET 6 on Windows 10, Windows 11
Visual Studio Version 2022
Workarounds?
A possible workaround is to set the InputLanguage for all elements that require language specification. However, it is very difficult to set it back to an infinite number of elements.
Scope
What are the .NET Framework versions, OSes & component/binaries affected?
Windows 10 version 22H2 & Windows 11
.NET 6
Is this a regression (when was it introduced)?
No, .NET Framework 4.8 behaved the same as .NET 6.
Issue Info
Problem Description
Setting RestoreInputLanguage to True should revert to the language in which it was focused when focusing out of the element, but the steps below will not revert to it. The framework needs to move back to the language for each element and then move on to the next element, but it seems to remember the only one previous language.
Steps to Repro
Before you begin, you need to install two keyboards, en-us and ja-jp.
1. Run the sample I attached
2. Click "1 (none)" TextBox
3. Switch the keyboard to ja-jp with Win+Space, etc.
4. Click "2 (en-us)" TextBox
5. Click "3 (en-us)" TextBox
6. Click "5 (none)" TextBox
Expected Results
==============
Reverted to ja-jp switched in Step 3
Actual results
============
It remains en-us.
Click 1 → 2 → 5 to return to ja-jp. Regardless of the previous language, click 4 → 2 → 5 to return to ja-jp. So it looks like the framework only remembers one time ago.
Workarounds attempted
Setting InputLanguage for all elements that require a language specification is not acceptable to the customer.
### Reproduction Steps
Before you begin, you need to install two keyboards, en-us and ja-jp.
1. Run the sample I attached
2. Click "1 (none)" TextBox
3. Switch the keyboard to ja-jp with Win+Space, etc.
4. Click "2 (en-us)" TextBox
5. Click "3 (en-us)" TextBox
6. Click "5 (none)" TextBox
Expected Results
==============
Reverted to ja-jp switched in Step 3
Actual results
============
It remains en-us.
### Expected behavior
Expected Results
==============
Reverted to ja-jp switched in Step 3
### Actual behavior
Actual results
============
It remains en-us.
### Regression?
No
### Known Workarounds
Setting InputLanguage for all elements that require a language specification is not acceptable to the customer.
### Impact
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.