Edit

Kongsi melalui


InputLanguageManager.GetInputLanguage(DependencyObject) Method

Definition

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

public:
 static System::Globalization::CultureInfo ^ GetInputLanguage(System::Windows::DependencyObject ^ target);
[System.ComponentModel.TypeConverter(typeof(System.Windows.CultureInfoIetfLanguageTagConverter))]
[System.Windows.AttachedPropertyBrowsableForType(typeof(System.Windows.DependencyObject))]
public static System.Globalization.CultureInfo GetInputLanguage (System.Windows.DependencyObject target);
[<System.ComponentModel.TypeConverter(typeof(System.Windows.CultureInfoIetfLanguageTagConverter))>]
[<System.Windows.AttachedPropertyBrowsableForType(typeof(System.Windows.DependencyObject))>]
static member GetInputLanguage : System.Windows.DependencyObject -> System.Globalization.CultureInfo
Public Shared Function GetInputLanguage (target As DependencyObject) As CultureInfo

Parameters

target
DependencyObject

The dependency object for which to retrieve the input language.

Returns

A CultureInfo object representing the input language for the specified dependency object.

Attributes

Exceptions

Raised when target is null.

Examples

The following example demonstrates how to use an InputLanguageManager to get 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()

Applies to

See also