InputLanguageManager 类

定义

提供用于管理 Windows Presentation Foundation (WPF) 中的输入语言的工具。Provides facilities for managing input languages in Windows Presentation Foundation (WPF).

public ref class InputLanguageManager sealed : System::Windows::Threading::DispatcherObject
public sealed class InputLanguageManager : System.Windows.Threading.DispatcherObject
type InputLanguageManager = class
    inherit DispatcherObject
Public NotInheritable Class InputLanguageManager
Inherits DispatcherObject
继承
InputLanguageManager

示例

下面的示例演示如何使用 InputLanguageManager 设置元素的输入语言 TextBoxThe following example demonstrates how to use an InputLanguageManager to set the input language of a TextBox element.

this.Dispatcher.Thread.CurrentCulture.Name.ToString();
InputLanguageManager.SetInputLanguage(myTextBox, CultureInfo.CreateSpecificCulture("fr"));
tb2.Text = "Available Input Languages:";
lb1.ItemsSource = InputLanguageManager.Current.AvailableInputLanguages;
tb3.Text = "Input Language of myTextBox is " + InputLanguageManager.GetInputLanguage(myTextBox).ToString();
tb4.Text = "CurrentCulture is Set to " + this.Dispatcher.Thread.CurrentCulture.Name.ToString();
Me.Dispatcher.Thread.CurrentCulture.Name.ToString()
InputLanguageManager.SetInputLanguage(myTextBox, CultureInfo.CreateSpecificCulture("fr"))
tb2.Text = "Available Input Languages:"
lb1.ItemsSource = InputLanguageManager.Current.AvailableInputLanguages
tb3.Text = "Input Language of myTextBox is " & InputLanguageManager.GetInputLanguage(myTextBox).ToString()
tb4.Text = "CurrentCulture is Set to " & Me.Dispatcher.Thread.CurrentCulture.Name.ToString()

注解

可以使用 "区域和语言选项" 控制面板注册其他语言。Additional languages can be registered by using the Regional and Language Options control panel. 在 "语言" 选项卡中,选择 "文本服务和输入语言",然后单击 "详细信息" 按钮以注册其他语言。From the Languages tab, select "Text Services and input languages", then click the "Details" button to register additional languages. 将显示以下对话框。The following dialog appears.

“文字服务和输入语言”对话框。Text services and input languages dialog.

字段

InputLanguageProperty

标识 InputLanguage 附加属性。Identifies the InputLanguage attached property.

RestoreInputLanguageProperty

标识 RestoreInputLanguage 附加属性。Identifies the RestoreInputLanguage attached property.

属性

AvailableInputLanguages

获取当前可用输入语言的枚举数。Gets an enumerator for currently available input languages.

Current

获取与当前上下文关联的输入语言管理器。Gets the input language manager associated with the current context.

CurrentInputLanguage

获取或设置当前输入语言。Gets or sets the current input language.

Dispatcher

获取与此 Dispatcher 关联的 DispatcherObjectGets the Dispatcher this DispatcherObject is associated with.

(继承自 DispatcherObject)

附加属性

InputLanguage

获取或设置关联的依赖对象的首选输入语言。Gets or sets the preferred input language for the associated dependency object.

RestoreInputLanguage

获取或设置一个值,该值指示是否应在关联依赖对象失去输入焦点时还原先前活动的输入语言。Gets or sets a value that indicates whether or not the previously active input language should be restored when the associated dependency object looses the input focus.

方法

CheckAccess()

确定调用线程是否可以访问此 DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

(继承自 DispatcherObject)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetInputLanguage(DependencyObject)

返回指定的依赖对象的 InputLanguage 附加属性值。Returns the value of the InputLanguage attached property for a specified dependency object.

GetRestoreInputLanguage(DependencyObject)

返回指定依赖对象的 RestoreInputLanguage 附加属性的值。Returns the value of RestoreInputLanguage attached property for a specified dependency object.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
RegisterInputLanguageSource(IInputLanguageSource)

InputLanguageManager 注册输入语言源。Registers an input language source with the InputLanguageManager.

ReportInputLanguageChanged(CultureInfo, CultureInfo)

InputLanguageManager 报告输入语言更改的完成。Report the completion of a change of input language to the InputLanguageManager.

ReportInputLanguageChanging(CultureInfo, CultureInfo)

InputLanguageManager 报告输入语言更改的启动。Report the initiation of a change of input language to the InputLanguageManager.

SetInputLanguage(DependencyObject, CultureInfo)

设置指定依赖对象上的 InputLanguage 附加属性的值。Sets the value of the InputLanguage attached property on the specified dependency object.

SetRestoreInputLanguage(DependencyObject, Boolean)

设置指定依赖对象上的 RestoreInputLanguage 依赖属性的值。Sets the value of the RestoreInputLanguage dependency property on the specified dependency object.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)
VerifyAccess()

强制调用线程具有此 DispatcherObject 的访问权限。Enforces that the calling thread has access to this DispatcherObject.

(继承自 DispatcherObject)

事件

InputLanguageChanged

在完成输入语言的更改时发生。Occurs when a change of input language is completed.

InputLanguageChanging

在启动输入语言的更改时发生。Occurs when a change of input language is initiated.

适用于

另请参阅