-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Trigger.xml
544 lines (488 loc) · 38.9 KB
/
Trigger.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
<Type Name="Trigger" FullName="System.Windows.Trigger">
<TypeSignature Language="C#" Value="public class Trigger : System.Windows.TriggerBase, System.Windows.Markup.IAddChild" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Trigger extends System.Windows.TriggerBase implements class System.Windows.Markup.IAddChild" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="DocId" Value="T:System.Windows.Trigger" />
<TypeSignature Language="VB.NET" Value="Public Class Trigger
Inherits TriggerBase
Implements IAddChild" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="F#" Value="type Trigger = class
 inherit TriggerBase
 interface IAddChild" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="C++ CLI" Value="public ref class Trigger : System::Windows::TriggerBase, System::Windows::Markup::IAddChild" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="C#" Value="public class Trigger : System.Windows.TriggerBase, System.ComponentModel.ISupportInitialize, System.Windows.Markup.IAddChild" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Trigger extends System.Windows.TriggerBase implements class System.ComponentModel.ISupportInitialize, class System.Windows.Markup.IAddChild" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<TypeSignature Language="VB.NET" Value="Public Class Trigger
Inherits TriggerBase
Implements IAddChild, ISupportInitialize" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<TypeSignature Language="F#" Value="type Trigger = class
 inherit TriggerBase
 interface IAddChild
 interface ISupportInitialize" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<TypeSignature Language="C++ CLI" Value="public ref class Trigger : System::Windows::TriggerBase, System::ComponentModel::ISupportInitialize, System::Windows::Markup::IAddChild" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<TypeSignature Language="F#" Value="type Trigger = class
 inherit TriggerBase
 interface ISupportInitialize
 interface IAddChild" FrameworkAlternate="windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Windows.TriggerBase</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Windows.Markup.IAddChild</InterfaceName>
</Interface>
<Interface FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0">
<InterfaceName>System.ComponentModel.ISupportInitialize</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Windows.Markup.ContentProperty("Setters")]</AttributeName>
<AttributeName Language="F#">[<System.Windows.Markup.ContentProperty("Setters")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Windows.Markup.XamlSetTypeConverter("ReceiveTypeConverter")]</AttributeName>
<AttributeName Language="F#">[<System.Windows.Markup.XamlSetTypeConverter("ReceiveTypeConverter")>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents a trigger that applies property values or performs actions conditionally.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
WPF defines properties that correspond to end-user actions, such as the <xref:System.Windows.UIElement.IsMouseOver%2A> property that is set to `true` when the user hovers the cursor over a <xref:System.Windows.UIElement> or the corresponding <xref:System.Windows.ContentElement.IsMouseOver%2A> property of a <xref:System.Windows.ContentElement>. Representing end-user actions in property values, along with the <xref:System.Windows.Trigger> element, allows WPF styles to change property values based on those end-user actions, all from within markup.
The properties changed by triggers are automatically reset to their previous value when the triggered condition is no longer satisfied. Triggers are optimized for transient states which are expected to change and return to original state, such as <xref:System.Windows.Controls.Primitives.ButtonBase.IsPressed%2A> on <xref:System.Windows.Controls.Button> and <xref:System.Windows.Controls.ListBoxItem.IsSelected%2A> on <xref:System.Windows.Controls.ListBoxItem>. The <xref:System.Windows.Trigger.Property%2A> of interest must be a dependency property.
Note that you must specify both the <xref:System.Windows.Trigger.Property%2A> and <xref:System.Windows.Trigger.Value%2A> properties on a <xref:System.Windows.Trigger> for the trigger to be meaningful. If one or both of the properties are not set, an exception is thrown.
The <xref:System.Windows.Trigger.Setters%2A> property of a <xref:System.Windows.Trigger> object can only consist of <xref:System.Windows.Setter> objects. Adding a <xref:System.Windows.Setter> child to a <xref:System.Windows.Trigger> object implicitly adds it to the <xref:System.Windows.SetterBaseCollection> for the <xref:System.Windows.Trigger> object. <xref:System.Windows.EventSetter> objects are not supported; only <xref:System.Windows.Style.Setters%2A?displayProperty=nameWithType> supports <xref:System.Windows.EventSetter> objects.
There are other types of triggers. <xref:System.Windows.MultiTrigger> allows you to apply changes based on the state of multiple properties. <xref:System.Windows.EventTrigger> allows you to apply changes when an event occurs. <xref:System.Windows.DataTrigger> and <xref:System.Windows.MultiDataTrigger> are for data-bound properties.
## Examples
The following example shows a named <xref:System.Windows.Style> available to <xref:System.Windows.Controls.Button> controls. The <xref:System.Windows.Style> defines a <xref:System.Windows.Trigger> element that changes the <xref:System.Windows.Controls.Control.Foreground%2A> property of a button when the <xref:System.Windows.Controls.Primitives.ButtonBase.IsPressed%2A> property is `true`.
:::code language="xaml" source="~/snippets/csharp/System.Windows/Setter/Overview/app1.xaml" id="Snippet2":::
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Trigger ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Trigger.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 Trigger();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Trigger" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Property">
<MemberSignature Language="C#" Value="public System.Windows.DependencyProperty Property { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.DependencyProperty Property" />
<MemberSignature Language="DocId" Value="P:System.Windows.Trigger.Property" />
<MemberSignature Language="VB.NET" Value="Public Property Property As DependencyProperty" />
<MemberSignature Language="F#" Value="member this.Property : System.Windows.DependencyProperty with get, set" Usage="System.Windows.Trigger.Property" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Windows::DependencyProperty ^ Property { System::Windows::DependencyProperty ^ get(); void set(System::Windows::DependencyProperty ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Modifiability=System.Windows.Modifiability.Unmodifiable, Readability=System.Windows.Readability.Unreadable)]</AttributeName>
<AttributeName Language="F#">[<System.Windows.Localizability(System.Windows.LocalizationCategory.None, Modifiability=System.Windows.Modifiability.Unmodifiable, Readability=System.Windows.Readability.Unreadable)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Windows.Markup.Ambient]</AttributeName>
<AttributeName Language="F#">[<System.Windows.Markup.Ambient>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.DependencyProperty</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the property that returns the value that is compared with the <see cref="P:System.Windows.Trigger.Value" /> property of the trigger. The comparison is a reference equality check.</summary>
<value>A <see cref="T:System.Windows.DependencyProperty" /> that returns the property value of the element. The default value is <see langword="null" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The value returned by this property is compared with the value specified by the <xref:System.Windows.Trigger.Value%2A> property. The comparison that is performed is a reference equality check. If the two values match, then the associated <xref:System.Windows.Setter>s 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 <xref:System.Windows.Trigger.Property%2A> and <xref:System.Windows.Trigger.Value%2A> properties on a <xref:System.Windows.Trigger> for the trigger to be meaningful. If one or both of the properties are not set, an exception is thrown.
## Examples
The following example contains a trigger that changes the <xref:System.Windows.Controls.Control.Foreground%2A> property of a button when the <xref:System.Windows.Controls.Primitives.ButtonBase.IsPressed%2A> property is `true`. Because the <xref:System.Windows.Style.TargetType%2A> of the <xref:System.Windows.Style> is set to <xref:System.Windows.Controls.Button>, there's no need to qualify the `Property` properties, for example, `Property="IsPressed"`, with the class name.
:::code language="xaml" source="~/snippets/csharp/System.Windows/Setter/Overview/app1.xaml" id="Snippet2":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">A <see cref="T:System.Windows.Style" /> cannot contain a <see cref="T:System.Windows.Trigger" /> that refers to the <see cref="T:System.Windows.Style" /> property.</exception>
<exception cref="T:System.InvalidOperationException">After a <see cref="T:System.Windows.Trigger" /> is in use, it cannot be modified.</exception>
<altmember cref="P:System.Windows.Trigger.Value" />
</Docs>
</Member>
<Member MemberName="ReceiveTypeConverter">
<MemberSignature Language="C#" Value="public static void ReceiveTypeConverter (object targetObject, System.Windows.Markup.XamlSetTypeConverterEventArgs eventArgs);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void ReceiveTypeConverter(object targetObject, class System.Windows.Markup.XamlSetTypeConverterEventArgs eventArgs) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Trigger.ReceiveTypeConverter(System.Object,System.Windows.Markup.XamlSetTypeConverterEventArgs)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub ReceiveTypeConverter (targetObject As Object, eventArgs As XamlSetTypeConverterEventArgs)" />
<MemberSignature Language="F#" Value="static member ReceiveTypeConverter : obj * System.Windows.Markup.XamlSetTypeConverterEventArgs -> unit" Usage="System.Windows.Trigger.ReceiveTypeConverter (targetObject, eventArgs)" />
<MemberSignature Language="C++ CLI" Value="public:
 static void ReceiveTypeConverter(System::Object ^ targetObject, System::Windows::Markup::XamlSetTypeConverterEventArgs ^ eventArgs);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="targetObject" Type="System.Object" Index="0" FrameworkAlternate="net-5.0;net-6.0;netcore-3.0;netcore-3.1;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;netframework-4.8.1;windowsdesktop-8.0;windowsdesktop-9.0" />
<Parameter Name="eventArgs" Type="System.Windows.Markup.XamlSetTypeConverterEventArgs" Index="1" FrameworkAlternate="net-5.0;net-6.0;netcore-3.0;netcore-3.1;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;netframework-4.8.1;windowsdesktop-8.0;windowsdesktop-9.0" />
</Parameters>
<Docs>
<param name="targetObject">The object where the type converter sets the value.</param>
<param name="eventArgs">Data that is relevant for type converter processing.</param>
<summary>Handles cases where a type converter provides a value for a property of a <see cref="T:System.Windows.Trigger" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This is the method referenced by an applied <xref:System.Windows.Markup.XamlSetTypeConverterAttribute> attribute at the class level, which means that this method processes all attempts to set values of <xref:System.Windows.Trigger> with a type converter. You do not typically call this method directly.
]]></format>
</remarks>
<altmember cref="T:System.Windows.Markup.XamlSetTypeConverterAttribute" />
<altmember cref="T:System.Windows.Markup.XamlSetTypeConverterEventArgs" />
</Docs>
</Member>
<Member MemberName="Setters">
<MemberSignature Language="C#" Value="public System.Windows.SetterBaseCollection Setters { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.SetterBaseCollection Setters" />
<MemberSignature Language="DocId" Value="P:System.Windows.Trigger.Setters" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Setters As SetterBaseCollection" />
<MemberSignature Language="F#" Value="member this.Setters : System.Windows.SetterBaseCollection" Usage="System.Windows.Trigger.Setters" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Windows::SetterBaseCollection ^ Setters { System::Windows::SetterBaseCollection ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.SetterBaseCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a collection of <see cref="T:System.Windows.Setter" /> objects, which describe the property values to apply when the specified condition has been met.</summary>
<value>The default value is <see langword="null" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<a name="xamlPropertyElementUsage_Setters"></a>
## XAML Property Element Usage
```
<object>
<object.Setters>
ZeroOrMoreSetters
</object.Setters>
</object>
```
<a name="xamlValues_Setters"></a>
## XAML Values
*ZeroOrMoreSetters*
Zero or more <xref:System.Windows.Setter> objects. This does not support <xref:System.Windows.EventSetter> object.
A <xref:System.Windows.Trigger> allows you to use <xref:System.Windows.Setter>s to apply property values when the element meets a specified condition. For example, you may want to change the background color of an element when it is in focus.
If the same property is set more than once, the last property value will be applied.
The <xref:System.Windows.Trigger.Setters%2A> property of a <xref:System.Windows.Trigger> object can only consist of <xref:System.Windows.Setter> objects. Adding a <xref:System.Windows.Setter> child to a <xref:System.Windows.Trigger> object implicitly adds it to the <xref:System.Windows.SetterBaseCollection> for the <xref:System.Windows.Trigger> object. <xref:System.Windows.EventSetter> objects are not supported; only <xref:System.Windows.Style.Setters%2A?displayProperty=nameWithType> supports <xref:System.Windows.EventSetter> objects.
## Examples
As mentioned above, adding a <xref:System.Windows.Setter> child to a <xref:System.Windows.Trigger> object implicitly adds it to the <xref:System.Windows.SetterBaseCollection> for the <xref:System.Windows.Trigger> object. In the following example, `<Trigger.Setters>` is implicit.
:::code language="xaml" source="~/snippets/csharp/System.Windows/Setter/Overview/window1.xaml" id="Snippettriggersettersref":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="SourceName">
<MemberSignature Language="C#" Value="public string SourceName { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string SourceName" />
<MemberSignature Language="DocId" Value="P:System.Windows.Trigger.SourceName" />
<MemberSignature Language="VB.NET" Value="Public Property SourceName As String" />
<MemberSignature Language="F#" Value="member this.SourceName : string with get, set" Usage="System.Windows.Trigger.SourceName" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ SourceName { System::String ^ get(); void set(System::String ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(null)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(null)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Windows.Markup.Ambient]</AttributeName>
<AttributeName Language="F#">[<System.Windows.Markup.Ambient>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the name of the object with the property that causes the associated setters to be applied.</summary>
<value>The default property is <see langword="null" />. If this property is <see langword="null" />, then the <see cref="P:System.Windows.Trigger.Property" /> property is evaluated with respect to the element this style or template is being applied to (the styled parent or the templated parent).</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can set this property to the name of any element within the scope of where the trigger collection (the collection that this <xref:System.Windows.Trigger> is part of) is applied. This is typically a named element that is within the template that contains this <xref:System.Windows.Trigger>.
You can name an object using the [x:Name Directive](/dotnet/framework/xaml-services/x-name-directive) syntax.
## Examples
One scenario when you would use the <xref:System.Windows.Trigger.SourceName%2A> property is when the property of interest is not a property of the templated parent, as in the following example:
:::code language="xaml" source="~/snippets/csharp/System.Windows/TemplateBindingExtension/Overview/menu.xaml" id="Snippettriggersourcename":::
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">After a <see cref="T:System.Windows.Trigger" /> is in use, it cannot be modified.</exception>
</Docs>
</Member>
<Member MemberName="System.ComponentModel.ISupportInitialize.BeginInit">
<MemberSignature Language="C#" Value="void ISupportInitialize.BeginInit ();" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.ComponentModel.ISupportInitialize.BeginInit() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Trigger.System#ComponentModel#ISupportInitialize#BeginInit" />
<MemberSignature Language="VB.NET" Value="Sub BeginInit () Implements ISupportInitialize.BeginInit" />
<MemberSignature Language="F#" Value="abstract member System.ComponentModel.ISupportInitialize.BeginInit : unit -> unit
override this.System.ComponentModel.ISupportInitialize.BeginInit : unit -> unit" Usage="trigger.System.ComponentModel.ISupportInitialize.BeginInit " />
<MemberSignature Language="C++ CLI" Value=" virtual void System.ComponentModel.ISupportInitialize.BeginInit() = System::ComponentModel::ISupportInitialize::BeginInit;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.ComponentModel.ISupportInitialize.BeginInit</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Signals the object that initialization is starting.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This member is an explicit interface member implementation. It can be used only when the <xref:System.Windows.Setter> instance is cast to an <xref:System.ComponentModel.ISupportInitialize> interface.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.ComponentModel.ISupportInitialize.EndInit">
<MemberSignature Language="C#" Value="void ISupportInitialize.EndInit ();" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.ComponentModel.ISupportInitialize.EndInit() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Trigger.System#ComponentModel#ISupportInitialize#EndInit" />
<MemberSignature Language="VB.NET" Value="Sub EndInit () Implements ISupportInitialize.EndInit" />
<MemberSignature Language="F#" Value="abstract member System.ComponentModel.ISupportInitialize.EndInit : unit -> unit
override this.System.ComponentModel.ISupportInitialize.EndInit : unit -> unit" Usage="trigger.System.ComponentModel.ISupportInitialize.EndInit " />
<MemberSignature Language="C++ CLI" Value=" virtual void System.ComponentModel.ISupportInitialize.EndInit() = System::ComponentModel::ISupportInitialize::EndInit;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.ComponentModel.ISupportInitialize.EndInit</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Signals the object that initialization is complete.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This member is an explicit interface member implementation. It can be used only when the <xref:System.Windows.Setter> instance is cast to an <xref:System.ComponentModel.ISupportInitialize> interface.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.Windows.Markup.IAddChild.AddChild">
<MemberSignature Language="C#" Value="void IAddChild.AddChild (object value);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Windows.Markup.IAddChild.AddChild(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Trigger.System#Windows#Markup#IAddChild#AddChild(System.Object)" />
<MemberSignature Language="VB.NET" Value="Sub AddChild (value As Object) Implements IAddChild.AddChild" />
<MemberSignature Language="F#" Value="abstract member System.Windows.Markup.IAddChild.AddChild : obj -> unit
override this.System.Windows.Markup.IAddChild.AddChild : obj -> unit" Usage="trigger.System.Windows.Markup.IAddChild.AddChild value" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Windows.Markup.IAddChild.AddChild(System::Object ^ value) = System::Windows::Markup::IAddChild::AddChild;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Windows.Markup.IAddChild.AddChild(System.Object)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">The child object to add.</param>
<summary>Adds a child object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This member is an explicit interface member implementation. It can be used only when the <xref:System.Windows.Trigger> instance is cast to an <xref:System.Windows.Markup.IAddChild> interface.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.Windows.Markup.IAddChild.AddText">
<MemberSignature Language="C#" Value="void IAddChild.AddText (string text);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Windows.Markup.IAddChild.AddText(string text) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Trigger.System#Windows#Markup#IAddChild#AddText(System.String)" />
<MemberSignature Language="VB.NET" Value="Sub AddText (text As String) Implements IAddChild.AddText" />
<MemberSignature Language="F#" Value="abstract member System.Windows.Markup.IAddChild.AddText : string -> unit
override this.System.Windows.Markup.IAddChild.AddText : string -> unit" Usage="trigger.System.Windows.Markup.IAddChild.AddText text" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Windows.Markup.IAddChild.AddText(System::String ^ text) = System::Windows::Markup::IAddChild::AddText;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Windows.Markup.IAddChild.AddText(System.String)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="text" Type="System.String" />
</Parameters>
<Docs>
<param name="text">The text to add to the object.</param>
<summary>Adds the text content of a node to the object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This member is an explicit interface member implementation. It can be used only when the <xref:System.Windows.Trigger> instance is cast to an <xref:System.Windows.Markup.IAddChild> interface.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Value">
<MemberSignature Language="C#" Value="public object Value { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance object Value" />
<MemberSignature Language="DocId" Value="P:System.Windows.Trigger.Value" />
<MemberSignature Language="VB.NET" Value="Public Property Value As Object" />
<MemberSignature Language="F#" Value="member this.Value : obj with get, set" Usage="System.Windows.Trigger.Value" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Object ^ Value { System::Object ^ get(); void set(System::Object ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]</AttributeName>
<AttributeName Language="F#">[<System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Windows.Markup.DependsOn("Property")]</AttributeName>
<AttributeName Language="F#">[<System.Windows.Markup.DependsOn("Property")>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Windows.Markup.DependsOn("SourceName")]</AttributeName>
<AttributeName Language="F#">[<System.Windows.Markup.DependsOn("SourceName")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.SetterTriggerConditionValueConverter))]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.SetterTriggerConditionValueConverter))>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the value to be compared with the property value of the element. The comparison is a reference equality check.</summary>
<value>The default value is <see langword="null" />. See also the Exceptions section.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This value is compared with the property value returned by the <xref:System.Windows.Trigger.Property%2A> property of the <xref:System.Windows.Trigger>. The comparison that is performed is a reference quality check. If the two values are equal, then the associated <xref:System.Windows.Setter>s apply the specified property values.
Note that you must specify both the <xref:System.Windows.Trigger.Property%2A> and <xref:System.Windows.Trigger.Value%2A> properties on a <xref:System.Windows.Trigger> for the trigger to be meaningful. Therefore, if one or both of the properties are not specified, then an exception is thrown.
<a name="xamlPropertyElementUsage_Value"></a>
## XAML Property Element Usage
```
<object>
<object.Value>
Value
</object.Value>
</object>
```
## Examples
The following example changes the <xref:System.Windows.Controls.Control.Foreground%2A> property of a button when the <xref:System.Windows.Controls.Primitives.ButtonBase.IsPressed%2A> property is `true`.
:::code language="xaml" source="~/snippets/csharp/System.Windows/Setter/Overview/app1.xaml" id="Snippet2":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">Expressions such as bindings are not supported.</exception>
<exception cref="T:System.InvalidOperationException">After a <see cref="T:System.Windows.Trigger" /> is in use, it cannot be modified.</exception>
<altmember cref="P:System.Windows.Trigger.Property" />
<altmember cref="P:System.Windows.Trigger.Setters" />
</Docs>
</Member>
</Members>
</Type>