Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Trigger Class
 Value Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
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)
XMLNS for XAML: http://schemas.microsoft.com/winfx/xaml/presentation
Visual Basic (Declaration)
<LocalizabilityAttribute(LocalizationCategory.None, Readability := Readability.Unreadable)> _
Public Property Value As Object
Visual Basic (Usage)
Dim instance As Trigger
Dim value As Object

value = instance.Value

instance.Value = value
C#
[LocalizabilityAttribute(LocalizationCategory.None, Readability = Readability.Unreadable)]
public Object Value { get; set; }
Visual C++
[LocalizabilityAttribute(LocalizationCategory::None, Readability = Readability::Unreadable)]
public:
property Object^ Value {
    Object^ get ();
    void set (Object^ value);
}
JScript
public function get Value () : Object
public function set Value (value : Object)
XAML Property Element Usage
<object>
  <object.Value>
    Value
  </object.Value>
</object>

Property Value

Type: System..::.Object
The default value is nullNothingnullptra null reference (Nothing in Visual Basic). See also the Exceptions section.
ExceptionCondition
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.

This value is compared with the property value returned by the Property property of the Trigger. The comparison that is performed is a reference quality check. If the two values are equal, then the associated Setters apply the specified property values.

Note that you must specify both the Property and Value properties on a Trigger for the trigger to be meaningful. Therefore, if one or both of the properties are not specified, then an exception is thrown.

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="IsPressed" Value="true">
        <Setter Property = "Foreground" Value="Green"/>
    </Trigger>
    </Style.Triggers>
</Style>

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker