Редагувати

Поділитися через


InputLanguageManager Class

Definition

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
Inheritance
InputLanguageManager

Examples

The 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()

Remarks

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.

Fields

InputLanguageProperty

Identifies the InputLanguage attached property.

RestoreInputLanguageProperty

Identifies the RestoreInputLanguage attached property.

Properties

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

Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)

Attached Properties

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.

Methods

CheckAccess()

Determines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetInputLanguage(DependencyObject)

Returns the value of the InputLanguage attached property for a specified dependency object.

GetRestoreInputLanguage(DependencyObject)

Returns the value of RestoreInputLanguage attached property for a specified dependency object.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RegisterInputLanguageSource(IInputLanguageSource)

Registers an input language source with the InputLanguageManager.

ReportInputLanguageChanged(CultureInfo, CultureInfo)

Report the completion of a change of input language to the InputLanguageManager.

ReportInputLanguageChanging(CultureInfo, CultureInfo)

Report the initiation of a change of input language to the InputLanguageManager.

SetInputLanguage(DependencyObject, CultureInfo)

Sets the value of the InputLanguage attached property on the specified dependency object.

SetRestoreInputLanguage(DependencyObject, Boolean)

Sets the value of the RestoreInputLanguage dependency property on the specified dependency object.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

Events

InputLanguageChanged

Occurs when a change of input language is completed.

InputLanguageChanging

Occurs when a change of input language is initiated.

Applies to

See also