다음을 통해 공유


Trigger.Value 속성

정의

요소의 속성 값과 비교할 값을 가져오거나 설정합니다. 비교는 참조 같음 검사입니다.

public:
 property System::Object ^ Value { System::Object ^ get(); void set(System::Object ^ value); };
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
[System.Windows.Markup.DependsOn("Property")]
[System.Windows.Markup.DependsOn("SourceName")]
public object Value { get; set; }
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
[System.Windows.Markup.DependsOn("Property")]
[System.Windows.Markup.DependsOn("SourceName")]
[System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.SetterTriggerConditionValueConverter))]
public object Value { get; set; }
[<System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)>]
[<System.Windows.Markup.DependsOn("Property")>]
[<System.Windows.Markup.DependsOn("SourceName")>]
member this.Value : obj with get, set
[<System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)>]
[<System.Windows.Markup.DependsOn("Property")>]
[<System.Windows.Markup.DependsOn("SourceName")>]
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.SetterTriggerConditionValueConverter))>]
member this.Value : obj with get, set
Public Property Value As Object

속성 값

기본값은 null입니다. 예외 섹션도 참조하세요.

특성

예외

바인딩과 같은 식은 지원되지 않습니다.

Trigger 사용 중이면 수정할 수 없습니다.

예제

다음 예에서는 속성이 . Foreground 인 경우 단추의 IsPressed 속성을 변경 합니다 true.

<Style x:Key="Triggers" TargetType="Button">
    <Style.Triggers>
    <Trigger Property="IsPressed" Value="true">
        <Setter Property = "Foreground" Value="Green"/>
    </Trigger>
    </Style.Triggers>
</Style>

설명

이 값은 의 속성에서 반환하는 Property 속성 값과 비교됩니다 Trigger. 수행되는 비교는 참조 품질 검사입니다. 두 값이 같으면 연결된 Setter값이 지정된 속성 값을 적용합니다.

트리거가 의미 있도록 트리거의 Property 속성과 Value 속성을 Trigger 모두 지정해야 합니다. 따라서 속성 중 하나 또는 둘 다를 지정하지 않으면 예외가 throw됩니다.

XAML 속성 요소 사용

<object>
  <object.Value>
    Value
  </object.Value>
</object>

적용 대상

추가 정보