共用方式為


InputLanguageManager.GetInputLanguage(DependencyObject) 方法

定義

傳回所指定相依性物件的 InputLanguage 附加屬性值。

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

參數

target
DependencyObject

要擷取輸入語言的相依性物件。

傳回

CultureInfo 物件代表所指定相依性物件的輸入語言。

屬性

例外狀況

targetnull 時引發。

範例

下列範例示範如何使用 InputLanguageManager 來取得專案的輸入語言 TextBox

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

適用於

另請參閱