SourceName Property
Collapse the table of content
Expand the table of content

Trigger.SourceName Property

Gets or sets the name of the object with the property that causes the associated setters to be applied.

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

public string SourceName { get; set; }
/** @property */
public String get_SourceName ()

/** @property */
public void set_SourceName (String value)

public function get SourceName () : String

public function set SourceName (value : String)

<object SourceName="string" .../>

Property Value

The default property is a null reference (Nothing in Visual Basic). If this property is a null reference (Nothing in Visual Basic), then the Property property is evaluated with respect to the element this style or template is being applied to (the styled parent or the templated parent).

Exception typeCondition

InvalidOperationException

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

You can set this property to the name of any element within the scope of where the trigger collection (the collection that this Trigger is part of) is applied. This is typically a named element that is within the template that contains this Trigger.

You can name an object using the x:Name Attribute syntax.

One scenario when you would use the SourceName property is when the property of interest is not a property of the templated parent, as in the following example:

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:
© 2016 Microsoft