在WPF中使用IME模式 [英] Using IME mode in WPF

查看:854
本文介绍了在WPF中使用IME模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个基于WPF的应用程序,我需要接受本地语言的数据。我能够在win表格中使用谷歌IME,但它在WPF中不起作用。



我明白IMEmode属性对于基于windows.form的用途很有用应用程序,但有没有办法在基于WPF的应用程序中以本地语言输入数据。

I am developing a WPF based application where I need to accept data in local language. I was able to do the same with google IME in win forms but it is not working in WPF.

I understand that the IMEmode property is useful with windows.form based application only but is there any way to input data in local language in a WPF based application.

推荐答案

我遇到了同样的问题。它在XP / Win7中的WinForm应用程序中都能正常工作。但它只适用于Win7中的Wpf。
I encountered the same problem. It works fine in WinForm application in both XP/Win7. But it only works for Wpf in Win7.


IT将使用下面的代码,例如日语



IT will work with code below , example for Japanese

foreach (System.Windows.Forms.InputLanguage lang in System.Windows.Forms.InputLanguage.InstalledInputLanguages)
               if (lang.LayoutName == "Japanese")
               {
                   System.Windows.Forms.InputLanguage.CurrentInputLanguage = lang;
                   InputMethod.Current.ImeState = InputMethodState.On;
               }





或简单设置xaml





or simple set in xaml

InputMethod.IsInputMethodEnabled="True" InputLanguageManager.InputLanguage="ja-JP"


这篇关于在WPF中使用IME模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆