Editar

Compartilhar via


Condition.Value Property

Definition

Gets or sets the value of the condition.

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

Property Value

The Value property cannot be null for a given Condition.

See also the Exceptions section. The default value is null.

Attributes

Exceptions

Expressions are not supported.

Examples

The following example contains two MultiTriggers. The first sets the MinWidth property value when the HasItems property is false and the Width property is Auto. The second one is similar but is for the MinHeight property.

<Style.Triggers>
  <Trigger Property="IsEnabled" Value="false">
    <Setter Property="Background" Value="#EEEEEE" />
  </Trigger>

  <MultiTrigger>
    <MultiTrigger.Conditions>
      <Condition Property="HasItems" Value="false" />
      <Condition Property="Width" Value="Auto" />
    </MultiTrigger.Conditions>
    <Setter Property="MinWidth" Value="120"/>
  </MultiTrigger>

  <MultiTrigger>
    <MultiTrigger.Conditions>
      <Condition Property="HasItems" Value="false" />
      <Condition Property="Height" Value="Auto" />
    </MultiTrigger.Conditions>
    <Setter Property="MinHeight" Value="95"/>
  </MultiTrigger>
</Style.Triggers>

See the Binding property for examples of conditions used in a MultiDataTrigger.

Remarks

MultiTriggers and MultiDataTriggers allow you to set property values based on a set of conditions. A condition is satisfied when the property value of the element or data item matches the specified Value. If all specified conditions are satisfied, then the trigger is applied. If all specified conditions are satisfied, then the trigger is applied.

Applies to