Partilhar via


InputLanguageManager.GetInputLanguage(DependencyObject) Método

Definição

Retorna o valor da propriedade InputLanguage anexada para um objeto de dependência especificado.

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

Parâmetros

target
DependencyObject

O objeto de dependência para o qual recuperar o idioma de entrada.

Retornos

Um objeto CultureInfo que representa o idioma de entrada para o objeto de dependência especificado.

Atributos

Exceções

Gerada quando target é null.

Exemplos

O exemplo a seguir demonstra como usar um InputLanguageManager para obter a linguagem de entrada de um TextBox elemento.

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

Aplica-se a

Confira também