EventTrigger.SourceName Property

Gets or sets the name of the object with the event that activates this trigger. This is only used by element triggers or template triggers.

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

'Declaration
Public Property SourceName As String
<object SourceName="string" .../>

Property Value

Type: System.String
The default value is Nothing. If this property value is Nothing, then the element being monitored for the raising of the event is the templated parent or the logical tree root.

ExceptionCondition
InvalidOperationException

After an EventTrigger 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 EventTrigger is part of) is applied. This is typically a named element that is within the template that contains this EventTrigger. If you are setting the Triggers property on an element directly, then it is a named element within the scope of that parent element.

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

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft