InputLanguageManager.SetInputLanguage Method (DependencyObject, CultureInfo)

 

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

Namespace:   System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public static void SetInputLanguage(
	DependencyObject target,
	CultureInfo inputLanguage
)

Parameters

target
Type: System.Windows.DependencyObject

The dependency object on which to set the InputLanguage attached property.

inputLanguage
Type: System.Globalization.CultureInfo

A CultureInfo object representing the new value for the InputLanguage attached property.

Exception Condition
ArgumentNullException

Raised when target is null.

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

.NET Framework
Available since 3.0
Return to top
Show: