IRawElementProviderFragmentRoot.GetFocus Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Giriş odağı olan bu parçadaki öğesini alır.
public:
System::Windows::Automation::Provider::IRawElementProviderFragment ^ GetFocus();
public System.Windows.Automation.Provider.IRawElementProviderFragment GetFocus ();
abstract member GetFocus : unit -> System.Windows.Automation.Provider.IRawElementProviderFragment
Public Function GetFocus () As IRawElementProviderFragment
Döndürülenler
Varsa, giriş odağını içeren bu parçadaki öğenin sağlayıcısı; aksi takdirde, null başvuru (Nothing
Visual Basic).
Örnekler
Aşağıdaki kod örneği, bir liste kutusu için bu yöntemin olası bir uygulamasını gösterir. Listede seçili durumdaki öğeyi döndürür.
/// <summary>
/// Returns the child element that is selected when the list gets focus.
/// </summary>
/// <returns>The selected item.</returns>
/// <remarks>
/// SelectedIndex is a class property that maintains the index of the currently
/// selected item in the myItems collection.</remarks>
IRawElementProviderFragment IRawElementProviderFragmentRoot.GetFocus()
{
if (SelectedIndex >= 0)
{
return (IRawElementProviderFragment)myItems[SelectedIndex];
}
else
{
return null;
}
}
''' <summary>
''' Returns the child element that is selected when the list gets focus.
''' </summary>
''' <returns>The selected item.</returns>
''' <remarks>
''' SelectedIndex is a class property that maintains the index of the currently
''' selected item in the myItems collection.</remarks>
Function GetFocus() As IRawElementProviderFragment _
Implements IRawElementProviderFragmentRoot.GetFocus
If SelectedIndex >= 0 Then
Return DirectCast(myItems(SelectedIndex), IRawElementProviderFragment)
Else
Return Nothing
End If
End Function 'IRawElementProviderFragmentRoot.GetFocus
Açıklamalar
Odak, bu parça tarafından barındırılan başka bir çerçevedeki bir öğedeyse, yöntemi bu parçayı barındıran öğeyi döndürür.