Επεξεργασία

Κοινή χρήση μέσω


MultiTrigger.Conditions Property

Definition

Gets a collection of Condition objects. Changes to property values are applied when all of the conditions in the collection are met.

public:
 property System::Windows::ConditionCollection ^ Conditions { System::Windows::ConditionCollection ^ get(); };
public System.Windows.ConditionCollection Conditions { get; }
member this.Conditions : System.Windows.ConditionCollection
Public ReadOnly Property Conditions As ConditionCollection

Property Value

The default is an empty collection.

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>

Remarks

XAML Property Element Usage

<object>
  <object.Conditions>
    ZeroOrMoreConditions
  </object.Conditions>
</object>

XAML Values

ZeroOrMoreConditions Zero or more Condition objects.

MultiTrigger enables you to set property values or start actions based on a collection of Condition objects. A condition is met when the value of the property (specified by the Property property of the Condition class) of the element matches the specified Value. The comparison that is performed is a reference equality check. The MultiTrigger applies the associated setters or actions when all of the conditions are true (binary and operation).

Note that for MultiTriggers, each condition in the collection must set both the Property and Value properties. See the Condition page for more information.

Applies to

See also