Bagikan melalui


InputLanguageManager.SetInputLanguage(DependencyObject, CultureInfo) Metode

Definisi

Mengatur nilai InputLanguage properti terlampir pada objek dependensi yang ditentukan.

public:
 static void SetInputLanguage(System::Windows::DependencyObject ^ target, System::Globalization::CultureInfo ^ inputLanguage);
public static void SetInputLanguage (System.Windows.DependencyObject target, System.Globalization.CultureInfo inputLanguage);
static member SetInputLanguage : System.Windows.DependencyObject * System.Globalization.CultureInfo -> unit
Public Shared Sub SetInputLanguage (target As DependencyObject, inputLanguage As CultureInfo)

Parameter

target
DependencyObject

Objek dependensi untuk mengatur InputLanguage properti terlampir.

inputLanguage
CultureInfo

Objek CultureInfo yang mewakili nilai baru untuk InputLanguage properti terlampir.

Pengecualian

Dimunculkan ketika target adalah null.

Contoh

Contoh berikut menunjukkan cara menggunakan InputLanguageManager untuk mengatur bahasa TextBox input elemen.

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

Berlaku untuk

Lihat juga