ValuePattern.ValuePatternInformation.Value 속성

정의

UI 자동화 요소의 값을 가져옵니다.

public:
 property System::String ^ Value { System::String ^ get(); };
public string Value { get; }
member this.Value : string
Public ReadOnly Property Value As String

속성 값

문자열로 UI 자동화 요소의 값입니다. 기본값은 빈 문자열입니다.

예제

다음 예제 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

설명

한 줄 편집 컨트롤은 을 통해 ValuePattern해당 콘텐츠에 프로그래밍 방식으로 액세스할 수 있도록 지원합니다. 그러나 여러 줄 편집 컨트롤은 컨트롤 패턴을 지원하지 ValuePattern 않습니다.

여러 줄 편집 컨트롤의 텍스트 내용을 검색하려면 컨트롤이 컨트롤 패턴을 지원 TextPattern 해야 합니다. 그러나 TextPattern 컨트롤의 값 설정은 지원하지 않습니다.

ValuePattern 에서는 서식 지정 정보 또는 부분 문자열 값 검색을 지원하지 않습니다. TextPattern 이러한 시나리오에서는 컨트롤 패턴을 사용해야 합니다.

적용 대상

추가 정보