Export (0) Print
Expand All

Condition.Value Property

Gets or sets the value of the condition.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

[<TypeConverterAttribute(typeof(SetterTriggerConditionValueConverter))>]
member Value : Object with get, set
<object>
  <object.Value>
    <Object .../>
  </object.Value>
</object>

Property Value

Type: System.Object
The Value property cannot be null for a given Condition.
See also the Exceptions section. The default value is null.

ExceptionCondition
ArgumentException

MarkupExtensions are not supported.

ArgumentException

Expressions are not supported.

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.

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft