Today, I encountered a depressing problem. Because in the input method state, all the keys captured in the keydown event of textbox are imeprocessed, and according to E. imeprocessedkey is used to obtain the real press key, which is also called imeprocessed. When I was depressed, I suddenly got a brainwave and thought that the input method could not be used in the passwordbox provided by the system. So I checked it with reflector.Source codeIt is found that he made the following settings in the static constructor:
Code
Inputmethod. isinputmethodenabledproperty. overridemetadata ( Typeof (Passwordbox ), New Frameworkpropertymetadata (booleanboxes. falsebox, frameworkpropertymetadataoptions. inherits, Null , New Coercevaluecallback (passwordbox. forcetofalse )));
Simply put, you can set an additional attribute named isinputmethodenabled of inputmethod to shield the input method.
The methods used in WPF and SL are as follows:
WPF
< Window X: Class = "Wpfmodelviewapplication1.views. mainview"
Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns: Input = "CLR-namespace: system. Windows. input; Assembly = presentationcore"
Title = "Main Window" Height = "400" Width = "800" >
< Dockpanel >
< Grid X: Name = "Grid1" >
< Textbox X: Name = "TB" Width = "100" Horizontalalignment = "Right" Margin = "0,164,122,128" Input: inputmethod. isinputmethodenabled = "False" />
</ Grid >
</ Dockpanel >
</ Window >
SL
< Usercontrol X: Class = "Silverlightapplication1.mainpage"
Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns: Input = "CLR-namespace: system. Windows. input; Assembly = system. Windows" >
< Stackpanel X: Name = "Layoutroot" >
< Textbox X: Name = "Tb1" Width = "100" Height = "100" Input: inputmethod. isinputmethodenabled = "False" />
</ Stackpanel >
</ Usercontrol >
A small feature that is very practical but rarely known. I hope it can help you.