Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Trigger Class
 Property Property
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..::.Property Property

Updated: November 2007

Gets or sets the property that returns the value that is compared with the Value property of the trigger. 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, Modifiability := Modifiability.Unmodifiable,  _
    Readability := Readability.Unreadable)> _
Public Property Property As DependencyProperty
Visual Basic (Usage)
Dim instance As Trigger
Dim value As DependencyProperty

value = instance.Property

instance.Property = value
C#
[LocalizabilityAttribute(LocalizationCategory.None, Modifiability = Modifiability.Unmodifiable, 
    Readability = Readability.Unreadable)]
public DependencyProperty Property { get; set; }
Visual C++
[LocalizabilityAttribute(LocalizationCategory::None, Modifiability = Modifiability::Unmodifiable, 
    Readability = Readability::Unreadable)]
public:
property DependencyProperty^ Property {
    DependencyProperty^ get ();
    void set (DependencyProperty^ value);
}
J#
/** @property */
/** @attribute LocalizabilityAttribute(LocalizationCategory.None, Modifiability = Modifiability.Unmodifiable, Readability = Readability.Unreadable) */
public DependencyProperty get_Property()
/** @property */
/** @attribute LocalizabilityAttribute(LocalizationCategory.None, Modifiability = Modifiability.Unmodifiable, Readability = Readability.Unreadable) */
public  void set_Property(DependencyProperty value)
JScript
public function get Property () : DependencyProperty
public function set Property (value : DependencyProperty)
XAML Attribute Usage
<object Property="DependencyProperty" .../>

Property Value

Type: System.Windows..::.DependencyProperty

A DependencyProperty that returns the property value of the element. The default value is nullNothingnullptra null reference (Nothing in Visual Basic).

ExceptionCondition
ArgumentException

A Style cannot contain a Trigger that refers to the Style property.

InvalidOperationException

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

The value returned by this property is compared with the value specified by the Value property. The comparison that is performed is a reference equality check. If the two values match, then the associated Setters apply the specified property values.

Use the ClassName.PropertyName syntax to qualify the property you are specifying if the style or template that contains this trigger does not have the TargetType property set.

Note that you must specify both the Property and Value properties on a Trigger for the trigger to be meaningful. If one or both of the properties are not set, 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. The TargetType of the Style is set to Button and therefore there is no need to qualify the Property properties with the class name.

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

Windows Vista

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
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker