ValuePattern.ValueProperty 字段
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
标识 Value 属性。
public: static initonly System::Windows::Automation::AutomationProperty ^ ValueProperty;
public static readonly System.Windows.Automation.AutomationProperty ValueProperty;
staticval mutable ValueProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ValueProperty As AutomationProperty
字段值
示例
在以下示例中 ValuePattern ,从目标控件获取的对象将传递到检索当前 ValuePattern 属性值的函数中。
///--------------------------------------------------------------------
/// <summary>
/// Gets the current property values from target.
/// </summary>
/// <param name="valuePattern">
/// A ValuePattern control pattern obtained from
/// an automation element representing a target control.
/// </param>
/// <param name="automationProperty">
/// The automation property of interest.
/// </param>
///--------------------------------------------------------------------
private object GetValueProperty(
ValuePattern valuePattern,
AutomationProperty automationProperty)
{
if (valuePattern == null || automationProperty == null)
{
throw new ArgumentNullException("Argument cannot be null.");
}
if (automationProperty.Id ==
ValuePattern.ValueProperty.Id)
{
return valuePattern.Current.Value;
}
return null;
}
'''--------------------------------------------------------------------
''' <summary>
''' Gets the current property values from target.
''' </summary>
''' <param name="valuePattern">
''' A ValuePattern control pattern obtained from
''' an automation element representing a target control.
''' </param>
''' <param name="automationProperty">
''' The automation property of interest.
''' </param>
'''--------------------------------------------------------------------
Private Function GetValueProperty( _
ByVal valuePattern As ValuePattern, _
ByVal automationProperty As AutomationProperty) As Object
If (valuePattern Is Nothing Or automationProperty Is Nothing) Then
Throw New ArgumentNullException("Argument cannot be null.")
End If
If automationProperty.Id = valuePattern.ValueProperty.Id Then
Return valuePattern.Current.Value
End If
Return Nothing
End Function 'GetValueProperty
注解
UI 自动化客户端应用程序使用此标识符。 UI 自动化提供程序应使用 中的 ValuePatternIdentifiers等效字段。