TablePattern.RowHeadersProperty 字段
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
标识用于获取表的行标题集合的属性。
public: static initonly System::Windows::Automation::AutomationProperty ^ RowHeadersProperty;
public static readonly System.Windows.Automation.AutomationProperty RowHeadersProperty;
staticval mutable RowHeadersProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly RowHeadersProperty As AutomationProperty
字段值
示例
在以下示例中,检索表示表的主行或列标题的对象数组 AutomationElement 。
本示例演示了属性与行标题项和列标题项之间的关系 RowOrColumnMajor 。 但是,无论表的属性如何,表都可以有行标题和列标题 RowOrColumnMajor 。
///--------------------------------------------------------------------
/// <summary>
/// Obtains an array of primary table headers.
/// </summary>
/// <param name="targetControl">
/// The target control of interest.
/// </param>
/// <param name="roworcolumnMajor">
/// The RowOrColumnMajor specifier.
/// </param>
/// <returns>
/// An array of automation elements.
/// </returns>
///--------------------------------------------------------------------
private AutomationElement[] GetPrimaryHeaders(
AutomationElement targetControl, RowOrColumnMajor roworcolumnMajor)
{
if (targetControl == null)
{
throw new ArgumentException("Target element cannot be null.");
}
try
{
if (roworcolumnMajor ==
RowOrColumnMajor.RowMajor)
{
return targetControl.GetCurrentPropertyValue(
TablePattern.RowHeadersProperty) as AutomationElement[];
}
if (roworcolumnMajor ==
RowOrColumnMajor.ColumnMajor)
{
return targetControl.GetCurrentPropertyValue(
TablePattern.ColumnHeadersProperty) as AutomationElement[];
}
}
catch (InvalidOperationException)
{
// TablePattern not supported.
// TO DO: error processing.
}
return null;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains an array of primary table headers.
''' </summary>
''' <param name="targetControl">
''' The target control of interest.
''' </param>
''' <param name="roworcolumnMajor">
''' The RowOrColumnMajor specifier.
''' </param>
''' <returns>
''' Automation element array objects.
''' </returns>
'''--------------------------------------------------------------------
Private Overloads Function GetPrimaryHeaders( _
ByVal targetControl As AutomationElement, _
ByVal roworcolumnMajor As RowOrColumnMajor) As AutomationElement()
If targetControl Is Nothing Then
Throw New ArgumentException("Target element cannot be null.")
End If
Try
If roworcolumnMajor = roworcolumnMajor.RowMajor Then
Return DirectCast(targetControl.GetCurrentPropertyValue( _
TablePattern.RowHeadersProperty), AutomationElement())
End If
If roworcolumnMajor = roworcolumnMajor.ColumnMajor Then
Return DirectCast(targetControl.GetCurrentPropertyValue( _
TablePattern.ColumnHeadersProperty), AutomationElement())
End If
Catch exc As InvalidOperationException
' TablePattern not supported.
' TO DO: error processing.
End Try
Return Nothing
End Function 'GetPrimaryHeaders
注解
此标识符由UI 自动化客户端应用程序使用。 UI 自动化提供程序应使用等效字段。TablePatternIdentifiers
返回的标头的顺序将在提供程序内保持一致,但不一定跨提供程序。
此属性不存在, TablePattern.TablePatternInformation 必须使用 GetCurrentPropertyValue 或 GetCachedPropertyValue检索此属性。