Export (0) Print
Expand All

Trigger.Value Property

Gets or sets the value to be compared with the property value of the element. The comparison is a reference equality check.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)] 
public Object Value { get; set; }
/** @property */
public Object get_Value ()

/** @property */
public void set_Value (Object value)

public function get Value () : Object

public function set Value (value : Object)

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

Property Value

The default value is a null reference (Nothing in Visual Basic). See also the Exceptions section.

Exception typeCondition

ArgumentException

Only load-time MarkupExtensions are supported.

ArgumentException

Expressions such as bindings are not supported.

InvalidOperationException

After a Trigger is in use, it cannot be modified.

The following example contains two triggers. The first changes the Background property of a Button when the IsMouseOver property is true. The second changes the Foreground property of a button when the IsPressed property is true.

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft