-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Application.xml
2563 lines (2208 loc) · 181 KB
/
Application.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
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Type Name="Application" FullName="System.Windows.Application">
<TypeSignature Language="C#" Value="public class Application : System.Windows.Threading.DispatcherObject" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi Application extends System.Windows.Threading.DispatcherObject" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="DocId" Value="T:System.Windows.Application" />
<TypeSignature Language="VB.NET" Value="Public Class Application
Inherits DispatcherObject" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="F#" Value="type Application = class
 inherit DispatcherObject" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="C++ CLI" Value="public ref class Application : System::Windows::Threading::DispatcherObject" FrameworkAlternate="netframework-3.0;netframework-3.5" />
<TypeSignature Language="C#" Value="public class Application : System.Windows.Threading.DispatcherObject, System.Windows.Markup.IQueryAmbient" 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 Application extends System.Windows.Threading.DispatcherObject implements class System.Windows.Markup.IQueryAmbient" 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="VB.NET" Value="Public Class Application
Inherits DispatcherObject
Implements IQueryAmbient" 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 Application = class
 inherit DispatcherObject
 interface IQueryAmbient" 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="C++ CLI" Value="public ref class Application : System::Windows::Threading::DispatcherObject, System::Windows::Markup::IQueryAmbient" 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 Application extends System.Windows.Threading.DispatcherObject implements class System.Windows.Markup.IQueryAmbient" 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.Threading.DispatcherObject</BaseTypeName>
</Base>
<Interfaces>
<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.Windows.Markup.IQueryAmbient</InterfaceName>
</Interface>
</Interfaces>
<Docs>
<summary>Encapsulates a Windows Presentation Foundation application.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Application> is a class that encapsulates WPF application-specific functionality, including the following:
- **Application Lifetime**: <xref:System.Windows.Application.Activated>, <xref:System.Windows.Application.Current%2A>, <xref:System.Windows.Application.Deactivated>, <xref:System.Windows.Application.DispatcherUnhandledException>, <xref:System.Windows.Application.Exit>, <xref:System.Windows.Application.Run%2A>, <xref:System.Windows.Application.SessionEnding>, <xref:System.Windows.Application.Shutdown%2A>, <xref:System.Windows.Application.ShutdownMode%2A>, <xref:System.Windows.Application.Startup>.
- **Application-Scope Window, Property, and Resource Management**: <xref:System.Windows.Application.FindResource%2A>, <xref:System.Windows.Application.GetContentStream%2A>, <xref:System.Windows.Application.GetResourceStream%2A>, <xref:System.Windows.Application.LoadComponent%2A>, <xref:System.Windows.Application.MainWindow%2A>, <xref:System.Windows.Application.Properties%2A>, <xref:System.Windows.Application.Resources%2A>, <xref:System.Windows.Application.StartupUri%2A>, <xref:System.Windows.Application.Windows%2A>.
- **Command-Line Parameter and Exit Code Processing**: <xref:System.Windows.Application.Startup?displayProperty=nameWithType>, <xref:System.Windows.Application.Exit?displayProperty=nameWithType>, <xref:System.Windows.Application.Shutdown%2A?displayProperty=nameWithType>.
- **Navigation**: <xref:System.Windows.Application.FragmentNavigation>, <xref:System.Windows.Application.LoadCompleted>, <xref:System.Windows.Application.Navigated>, <xref:System.Windows.Application.Navigating>, <xref:System.Windows.Application.NavigationProgress>, <xref:System.Windows.Application.NavigationStopped>, <xref:System.Windows.Application.NavigationFailed>, <xref:System.Windows.Application.SetCookie%2A>, <xref:System.Windows.Application.GetCookie%2A>.
<xref:System.Windows.Application> implements the singleton pattern to provide shared access to its window, property, and resource scope services. Consequently, only one instance of the <xref:System.Windows.Application> class can be created per <xref:System.AppDomain>.
You can implement an <xref:System.Windows.Application> using markup, markup and code-behind, or code. If <xref:System.Windows.Application> is implemented with markup, whether markup or markup and code-behind, the markup file must be configured as an Microsoft build engine (MSBuild) `ApplicationDefinition` item.
> [!NOTE]
> A standalone application does not require an <xref:System.Windows.Application> object; it is possible to implement a custom `static` entry point method (`Main`) that opens a window without creating an instance of <xref:System.Windows.Application>. However, XAML browser applications (XBAPs) require an <xref:System.Windows.Application> object.
## Examples
The following example shows how a standard application is defined using only markup:
:::code language="xaml" source="~/snippets/csharp/System.Windows/Application/Overview/AppMarkup.xaml" id="Snippetapplicationmarkup":::
The following example shows how a standard application is defined using only code:
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/Overview/AppCode.cs" id="Snippetapplicationcode":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ApplicationSnippets/visualbasic/appcode.vb" id="Snippetapplicationcode":::
The following example shows how a standard application is defined using a combination of markup and code-behind.
:::code language="xaml" source="~/snippets/csharp/System.Windows/Application/Overview/App.xaml" id="Snippetapplicationxaml":::
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/Overview/App.xaml.cs" id="Snippetapplicationcodebehind":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ApplicationSnippets/visualbasic/application.xaml.vb" id="Snippetapplicationcodebehind":::
]]></format>
</remarks>
<threadsafe>The public <see langword="static" /> (<see langword="Shared" /> in Visual Basic) members of this type are thread safe. In addition, the <see cref="M:System.Windows.Application.FindResource(System.Object)" /> and <see cref="M:System.Windows.Application.TryFindResource(System.Object)" /> methods and the <see cref="P:System.Windows.Application.Properties" /> and <see cref="P:System.Windows.Application.Resources" /> properties are thread safe.</threadsafe>
<altmember cref="T:System.Windows.Window" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Application ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Application.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 Application();" />
<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>
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;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">
<AttributeName Language="C#">[System.Security.SecurityCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecurityCritical>]</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Application" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Only one instance of the <xref:System.Windows.Application> class can be created per <xref:System.AppDomain>, to ensure shared access to a single set of application-scope window, property, and resource data. Consequently, the parameterless constructor of the <xref:System.Windows.Application> class detects whether the instance being initialized is the first instance in an <xref:System.AppDomain>; if it is not, an <xref:System.InvalidOperationException> is thrown.
The <xref:System.Windows.Application> object for the current <xref:System.AppDomain> is exposed from the static <xref:System.Windows.Application.Current%2A> property.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">More than one instance of the <see cref="T:System.Windows.Application" /> class is created per <see cref="T:System.AppDomain" />.</exception>
</Docs>
</Member>
<Member MemberName="Activated">
<MemberSignature Language="C#" Value="public event EventHandler Activated;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Activated" />
<MemberSignature Language="DocId" Value="E:System.Windows.Application.Activated" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Activated As EventHandler " FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.Activated : EventHandler " Usage="member this.Activated : System.EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event EventHandler ^ Activated;" />
<MemberSignature Language="VB.NET" Value="Public Event Activated As EventHandler " FrameworkAlternate="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" />
<MemberType>Event</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>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when an application becomes the foreground application.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A Windows Presentation Foundation application that has one or more open windows is activated (becomes the foreground application) when one of the windows is activated for the first time since the application was launched, or when one of the windows is activated while the application is inactive: Specifically, activation occurs when:
- An application opens its first window.
- A user switches to the application by using ALT+TAB or by using Task Manager.
- A user clicks the taskbar button for one of the windows in an application.
Applications that need to detect when they activate can handle the <xref:System.Windows.Application.Activated> event.
After an application is first activated, it may be deactivated and reactivated many times during its lifetime. If an application's behavior or state depends on its activation state, it can handle both <xref:System.Windows.Application.Activated> and <xref:System.Windows.Application.Deactivated> events to determine which activation state it's in.
Once an application becomes active, <xref:System.Windows.Application.Activated> will not be raised again until the application is deactivated, irrespective of how many windows within an application are activated while the application is active.
<xref:System.Windows.Application.Activated> is not raised for XAML browser applications (XBAPs).
## Examples
The following example shows how to detect when a standalone application activates and deactivates.
:::code language="xaml" source="~/snippets/csharp/System.Windows/Application/Activated/App.xaml" id="Snippetdetectactivationstatexaml":::
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/Activated/App.xaml.cs" id="Snippetdetectactivationstatecodebehind":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ApplicationActivationSnippets/visualbasic/application.xaml.vb" id="Snippetdetectactivationstatecodebehind":::
]]></format>
</remarks>
<altmember cref="M:System.Windows.Application.OnActivated(System.EventArgs)" />
<altmember cref="E:System.Windows.Application.Deactivated" />
</Docs>
</Member>
<Member MemberName="Current">
<MemberSignature Language="C#" Value="public static System.Windows.Application Current { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.Windows.Application Current" />
<MemberSignature Language="DocId" Value="P:System.Windows.Application.Current" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property Current As Application" />
<MemberSignature Language="F#" Value="static member Current : System.Windows.Application" Usage="System.Windows.Application.Current" />
<MemberSignature Language="C++ CLI" Value="public:
 static property System::Windows::Application ^ Current { System::Windows::Application ^ 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 FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Application</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="T:System.Windows.Application" /> object for the current <see cref="T:System.AppDomain" />.</summary>
<value>The <see cref="T:System.Windows.Application" /> object for the current <see cref="T:System.AppDomain" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Application> is a per-<xref:System.AppDomain> singleton type that implements the static <xref:System.Windows.Application.Current%2A> property to provide shared access to the <xref:System.Windows.Application> instance for the current <xref:System.AppDomain>. This design guarantees that state managed by <xref:System.Windows.Application>, including shared resources and state, is available from a single, shared location.
This property is thread safe and is available from any thread.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Deactivated">
<MemberSignature Language="C#" Value="public event EventHandler Deactivated;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Deactivated" />
<MemberSignature Language="DocId" Value="E:System.Windows.Application.Deactivated" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Deactivated As EventHandler " FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.Deactivated : EventHandler " Usage="member this.Deactivated : System.EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event EventHandler ^ Deactivated;" />
<MemberSignature Language="VB.NET" Value="Public Event Deactivated As EventHandler " FrameworkAlternate="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" />
<MemberType>Event</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>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when an application stops being the foreground application.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A Windows Presentation Foundation application that has one or more open windows deactivates (stops being the foreground application) when a user does the following:
- Switches to another application by using ALT+TAB or by using Task Manager.
- Clicks the taskbar button for a window in another application.
Applications that need to detect deactivation can handle the <xref:System.Windows.Application.Deactivated> event.
After an application is first activated, it may be deactivated and reactivated many times during its lifetime. If an application's behavior or state depends on its activation state, it can handle both <xref:System.Windows.Application.Deactivated> and <xref:System.Windows.Application.Activated> events to determine which state it's in.
<xref:System.Windows.Application.Deactivated> is not raised for XAML browser applications (XBAPs).
## Examples
The following example shows how to detect when a standalone application deactivates and activates.
:::code language="xaml" source="~/snippets/csharp/System.Windows/Application/Activated/App.xaml" id="Snippetdetectactivationstatexaml":::
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/Activated/App.xaml.cs" id="Snippetdetectactivationstatecodebehind":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ApplicationActivationSnippets/visualbasic/application.xaml.vb" id="Snippetdetectactivationstatecodebehind":::
]]></format>
</remarks>
<altmember cref="M:System.Windows.Application.OnDeactivated(System.EventArgs)" />
<altmember cref="E:System.Windows.Application.Activated" />
</Docs>
</Member>
<Member MemberName="DispatcherUnhandledException">
<MemberSignature Language="C#" Value="public event System.Windows.Threading.DispatcherUnhandledExceptionEventHandler DispatcherUnhandledException;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Threading.DispatcherUnhandledExceptionEventHandler DispatcherUnhandledException" />
<MemberSignature Language="DocId" Value="E:System.Windows.Application.DispatcherUnhandledException" />
<MemberSignature Language="VB.NET" Value="Public Custom Event DispatcherUnhandledException As DispatcherUnhandledExceptionEventHandler " />
<MemberSignature Language="F#" Value="member this.DispatcherUnhandledException : System.Windows.Threading.DispatcherUnhandledExceptionEventHandler " Usage="member this.DispatcherUnhandledException : System.Windows.Threading.DispatcherUnhandledExceptionEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::Threading::DispatcherUnhandledExceptionEventHandler ^ DispatcherUnhandledException;" />
<MemberType>Event</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>
<ReturnValue>
<ReturnType>System.Windows.Threading.DispatcherUnhandledExceptionEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when an exception is thrown by an application but not handled.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, Windows Presentation Foundation catches unhandled exceptions, notifies users of the exception from a dialog box (from which they can report the exception), and automatically shuts down an application.
However, if an application needs to perform custom unhandled exception processing from a centralized location, you should handle <xref:System.Windows.Application.DispatcherUnhandledException>.
<xref:System.Windows.Application.DispatcherUnhandledException> is raised by an <xref:System.Windows.Application> for each exception that is unhandled by code running on the main UI thread.
If an exception is not handled on either a background UI thread (a thread with its own <xref:System.Windows.Threading.Dispatcher>) or a background worker thread (a thread without a <xref:System.Windows.Threading.Dispatcher>), the exception is not forwarded to the main UI thread. Consequently, <xref:System.Windows.Application.DispatcherUnhandledException> is not raised. In these circumstances, you will need to write code to do the following:
1. Handle exceptions on the background thread.
2. Dispatch those exceptions to the main UI thread.
3. Rethrow them on the main UI thread without handling them to allow <xref:System.Windows.Application.DispatcherUnhandledException> to be raised.
For more information, see the [Threading Model](/dotnet/framework/wpf/advanced/threading-model) overview.
The <xref:System.Windows.Application.DispatcherUnhandledException> event handler is passed a <xref:System.Windows.Threading.DispatcherUnhandledExceptionEventArgs> argument that contains contextual information regarding the exception, including:
- The exception (<xref:System.Windows.Threading.DispatcherUnhandledExceptionEventArgs.Exception%2A>).
- The <xref:System.Windows.Threading.Dispatcher> from which it originated (<xref:System.Windows.Threading.DispatcherEventArgs.Dispatcher%2A>).
You can use this information to determine whether an exception is recoverable or not. A recoverable exception might be a <xref:System.IO.FileNotFoundException>, for example, while an unrecoverable exception might be a <xref:System.StackOverflowException>, for example.
When you process an unhandled exception from <xref:System.Windows.Application.DispatcherUnhandledException>, and you don't want WPF to continue processing it, you need to set the <xref:System.Windows.Threading.DispatcherUnhandledExceptionEventArgs.Handled%2A> property to `true`.
Unlike the other events that <xref:System.Windows.Application> raises, <xref:System.Windows.Application.DispatcherUnhandledException> does not have a matching protected virtual implementation (OnDispatcherUnhandledException). Consequently, classes that derive from <xref:System.Windows.Application> must always register an event handler with <xref:System.Windows.Application.DispatcherUnhandledException> to process unhandled exceptions.
## Examples
The following example shows how to process unhandled exceptions by handling the <xref:System.Windows.Application.DispatcherUnhandledException> event.
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/DispatcherUnhandledException/App.xaml.cs":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ApplicationDispatcherUnhandledExceptionSnippets/visualbasic/application.xaml.vb":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Exit">
<MemberSignature Language="C#" Value="public event System.Windows.ExitEventHandler Exit;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.ExitEventHandler Exit" />
<MemberSignature Language="DocId" Value="E:System.Windows.Application.Exit" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Exit As ExitEventHandler " />
<MemberSignature Language="F#" Value="member this.Exit : System.Windows.ExitEventHandler " Usage="member this.Exit : System.Windows.ExitEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::ExitEventHandler ^ Exit;" />
<MemberType>Event</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>
<ReturnValue>
<ReturnType>System.Windows.ExitEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs just before an application shuts down and cannot be canceled.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An application can shut down for either of the following reasons:
- The <xref:System.Windows.Application.Shutdown%2A> method of the <xref:System.Windows.Application> object is called, either explicitly or as determined by the <xref:System.Windows.Application.ShutdownMode%2A> property.
- The user ends the session by logging off or shutting down.
You can detect when application shutdown occurs by handling the <xref:System.Windows.Application.Exit> event, and perform any additional processing as required.
You can also handle <xref:System.Windows.Application.Exit> to inspect or change the application exit code when you don't need to call <xref:System.Windows.Application.Shutdown%2A> explicitly. The exit code is exposed from the <xref:System.Windows.ExitEventArgs.ApplicationExitCode%2A> property of the <xref:System.Windows.ExitEventArgs> argument that's passed to the <xref:System.Windows.Application.Exit> event handler. When the application stops running, the exit code is passed to the operating system for subsequent processing.
If your application handles the <xref:System.Windows.Application.SessionEnding> event and subsequently cancels it, <xref:System.Windows.Application.Exit> is not raised and the application continues running in accordance with the shutdown mode.
The exit code can be set from an XAML browser application (XBAP), although the value is ignored.
For XBAPs, <xref:System.Windows.Application.Exit> is raised in the following circumstances:
- An XBAP is navigated away from.
- When the browser tab that's hosting the XBAP is closed.
- When the browser is closed.
In all cases, the value of the <xref:System.Windows.ExitEventArgs.ApplicationExitCode%2A> property is ignored.
For more information about XBAP support, see [Frequently asked questions about WPF browser-hosted applications (XBAP)](/dotnet/desktop/wpf/app-development/xbap-faq?view=netframeworkdesktop-4.8).
## Examples
The following example demonstrates how to:
- Handle the <xref:System.Windows.Application.Exit> event.
- Inspect and update the <xref:System.Windows.ExitEventArgs.ApplicationExitCode%2A> property of the <xref:System.Windows.ExitEventArgs>.
- Write an entry to an application log in isolated storage.
- Persist the application state to isolated storage.
:::code language="xaml" source="~/snippets/csharp/System.Windows/Application/Exit/App.xaml" id="Snippethandleexitxaml":::
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/Exit/App.xaml.cs" id="Snippethandleexitcodebehind":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ApplicationExitSnippets/visualbasic/application.xaml.vb" id="Snippethandleexitcodebehind":::
]]></format>
</remarks>
<altmember cref="M:System.Windows.Application.OnExit(System.Windows.ExitEventArgs)" />
<altmember cref="E:System.Windows.Application.Startup" />
<altmember cref="T:System.IO.IsolatedStorage.IsolatedStorage" />
</Docs>
</Member>
<Member MemberName="FindResource">
<MemberSignature Language="C#" Value="public object FindResource (object resourceKey);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance object FindResource(object resourceKey) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Application.FindResource(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Function FindResource (resourceKey As Object) As Object" />
<MemberSignature Language="F#" Value="member this.FindResource : obj -> obj" Usage="application.FindResource resourceKey" />
<MemberSignature Language="C++ CLI" Value="public:
 System::Object ^ FindResource(System::Object ^ resourceKey);" />
<MemberType>Method</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>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="resourceKey" Type="System.Object" />
</Parameters>
<Docs>
<param name="resourceKey">The name of the resource to find.</param>
<summary>Searches for a user interface (UI) resource, such as a <see cref="T:System.Windows.Style" /> or <see cref="T:System.Windows.Media.Brush" />, with the specified key, and throws an exception if the requested resource is not found (see <see href="https://learn.microsoft.com/dotnet/framework/wpf/advanced/xaml-resources">XAML Resources</see>).</summary>
<returns>The requested resource object. If the requested resource is not found, a <see cref="T:System.Windows.ResourceReferenceKeyNotFoundException" /> is thrown.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Application.FindResource%2A> will first look in application-scope resources for the specified resource. Application-scope resources are managed by <xref:System.Windows.Application>, and are exposed from the <xref:System.Windows.Application.Resources%2A> property. If the specified resource is not found in the set of application-scope resources, <xref:System.Windows.Application.FindResource%2A> then next searches the system resources. System resources are shell resources defined by the user, and include colors, fonts, and shell configurations. These are exposed from the <xref:System.Windows.SystemColors>, <xref:System.Windows.SystemFonts>, and <xref:System.Windows.SystemParameters> types, respectively, as static properties. To use <xref:System.Windows.Application.FindResource%2A> to acquire them, these types also expose resource key properties that are designed to be passed to <xref:System.Windows.Application.FindResource%2A>; for example, <xref:System.Windows.SystemParameters.IconWidthKey%2A>.
Because <xref:System.Windows.Application.FindResource%2A> returns an object, you must cast the returned value to the appropriate type if the resource is found.
> [!IMPORTANT]
> If you call this method for a key that cannot be found, an exception is thrown. If you do not want to handle exceptions that result from calling <xref:System.Windows.Application.FindResource%2A>, call <xref:System.Windows.Application.TryFindResource%2A> instead; <xref:System.Windows.Application.TryFindResource%2A> returns a `null` reference when a requested resource cannot be found, and does not throw an exception.
This method is thread safe and can be called from any thread.
## Examples
The following example shows how to use <xref:System.Windows.Application.FindResource%2A> to find a resource, and to handle <xref:System.Windows.ResourceReferenceKeyNotFoundException> if the resource is not found.
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/FindResource/MainWindow.xaml.cs" id="Snippetapplicationcallfindresourcecodebehind":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ApplicationFindResourceSnippets/visualbasic/mainwindow.xaml.vb" id="Snippetapplicationcallfindresourcecodebehind":::
]]></format>
</remarks>
<exception cref="T:System.Windows.ResourceReferenceKeyNotFoundException">The resource cannot be found.</exception>
<altmember cref="M:System.Windows.Application.TryFindResource(System.Object)" />
</Docs>
</Member>
<Member MemberName="FragmentNavigation">
<MemberSignature Language="C#" Value="public event System.Windows.Navigation.FragmentNavigationEventHandler FragmentNavigation;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Navigation.FragmentNavigationEventHandler FragmentNavigation" />
<MemberSignature Language="DocId" Value="E:System.Windows.Application.FragmentNavigation" />
<MemberSignature Language="VB.NET" Value="Public Custom Event FragmentNavigation As FragmentNavigationEventHandler " FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.FragmentNavigation : System.Windows.Navigation.FragmentNavigationEventHandler " Usage="member this.FragmentNavigation : System.Windows.Navigation.FragmentNavigationEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::Navigation::FragmentNavigationEventHandler ^ FragmentNavigation;" />
<MemberSignature Language="VB.NET" Value="Public Event FragmentNavigation As FragmentNavigationEventHandler " FrameworkAlternate="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" />
<MemberType>Event</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>
<ReturnValue>
<ReturnType>System.Windows.Navigation.FragmentNavigationEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when a navigator in the application begins navigation to a content fragment, Navigation occurs immediately if the desired fragment is in the current content, or after the source XAML content has been loaded if the desired fragment is in different content.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A navigator is either a <xref:System.Windows.Navigation.NavigationWindow> or a <xref:System.Windows.Controls.Frame>.
See <xref:System.Windows.Navigation.NavigationService.FragmentNavigation?displayProperty=nameWithType>.
]]></format>
</remarks>
<altmember cref="E:System.Windows.Application.Navigated" />
<altmember cref="E:System.Windows.Application.Navigating" />
<altmember cref="E:System.Windows.Application.LoadCompleted" />
<altmember cref="E:System.Windows.Application.NavigationProgress" />
<altmember cref="E:System.Windows.Application.NavigationStopped" />
<altmember cref="E:System.Windows.Application.NavigationFailed" />
</Docs>
</Member>
<Member MemberName="GetContentStream">
<MemberSignature Language="C#" Value="public static System.Windows.Resources.StreamResourceInfo GetContentStream (Uri uriContent);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Windows.Resources.StreamResourceInfo GetContentStream(class System.Uri uriContent) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Application.GetContentStream(System.Uri)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetContentStream (uriContent As Uri) As StreamResourceInfo" />
<MemberSignature Language="F#" Value="static member GetContentStream : Uri -> System.Windows.Resources.StreamResourceInfo" Usage="System.Windows.Application.GetContentStream uriContent" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Windows::Resources::StreamResourceInfo ^ GetContentStream(Uri ^ uriContent);" />
<MemberType>Method</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 FrameworkAlternate="netframework-3.0;netframework-3.5;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">
<AttributeName Language="C#">[System.Security.SecurityCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecurityCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Resources.StreamResourceInfo</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="uriContent" Type="System.Uri" />
</Parameters>
<Docs>
<param name="uriContent">The relative <see cref="T:System.Uri" /> that maps to a loose resource.</param>
<summary>Returns a resource stream for a content data file that is located at the specified <see cref="T:System.Uri" /> (see <see href="https://learn.microsoft.com/dotnet/framework/wpf/app-development/wpf-application-resource-content-and-data-files">WPF Application Resource, Content, and Data Files</see>).</summary>
<returns>A <see cref="T:System.Windows.Resources.StreamResourceInfo" /> that contains a content data file that is located at the specified <see cref="T:System.Uri" />. If a loose resource is not found, null is returned.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is not thread safe.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <see cref="T:System.Uri" /> that is passed to <see cref="M:System.Windows.Application.GetContentStream(System.Uri)" /> is null.</exception>
<exception cref="T:System.ArgumentException">The <see cref="T:System.Uri" /> that is passed to <see cref="M:System.Windows.Application.GetContentStream(System.Uri)" /> is an absolute <see cref="T:System.Uri" />.</exception>
<altmember cref="M:System.Windows.Application.GetResourceStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetRemoteStream(System.Uri)" />
<altmember cref="Overload:System.Windows.Application.LoadComponent" />
</Docs>
</Member>
<Member MemberName="GetCookie">
<MemberSignature Language="C#" Value="public static string GetCookie (Uri uri);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetCookie(class System.Uri uri) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Application.GetCookie(System.Uri)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetCookie (uri As Uri) As String" />
<MemberSignature Language="F#" Value="static member GetCookie : Uri -> string" Usage="System.Windows.Application.GetCookie uri" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::String ^ GetCookie(Uri ^ uri);" />
<MemberType>Method</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>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="uri" Type="System.Uri" />
</Parameters>
<Docs>
<param name="uri">The <see cref="T:System.Uri" /> that specifies the location for which a cookie was created.</param>
<summary>Retrieves a cookie for the location specified by a <see cref="T:System.Uri" />.</summary>
<returns>A <see cref="T:System.String" /> value, if the cookie exists; otherwise, a <see cref="T:System.ComponentModel.Win32Exception" /> is thrown.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Application.GetCookie%2A> retrieves a cookie for the specified <xref:System.Uri>. If the cookie can't be retrieved, a <xref:System.ComponentModel.Win32Exception> is thrown. You need to write the code to parse the cookie string into a list of name/value pairs.
For an overview of cookies in WPF, see [Navigation Overview](/dotnet/framework/wpf/app-development/navigation-overview).
]]></format>
</remarks>
<exception cref="T:System.ComponentModel.Win32Exception">A Win32 error is raised by the <see langword="InternetGetCookie" /> function (called by <see cref="M:System.Windows.Application.GetCookie(System.Uri)" />) if a problem occurs when attempting to retrieve the specified cookie.</exception>
<altmember cref="M:System.Windows.Application.SetCookie(System.Uri,System.String)" />
</Docs>
</Member>
<Member MemberName="GetRemoteStream">
<MemberSignature Language="C#" Value="public static System.Windows.Resources.StreamResourceInfo GetRemoteStream (Uri uriRemote);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Windows.Resources.StreamResourceInfo GetRemoteStream(class System.Uri uriRemote) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Application.GetRemoteStream(System.Uri)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetRemoteStream (uriRemote As Uri) As StreamResourceInfo" />
<MemberSignature Language="F#" Value="static member GetRemoteStream : Uri -> System.Windows.Resources.StreamResourceInfo" Usage="System.Windows.Application.GetRemoteStream uriRemote" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Windows::Resources::StreamResourceInfo ^ GetRemoteStream(Uri ^ uriRemote);" />
<MemberType>Method</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 FrameworkAlternate="netframework-3.0;netframework-3.5;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">
<AttributeName Language="C#">[System.Security.SecurityCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecurityCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Resources.StreamResourceInfo</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="uriRemote" Type="System.Uri" />
</Parameters>
<Docs>
<param name="uriRemote">The <see cref="T:System.Uri" /> that maps to a loose resource at the site of origin.</param>
<summary>Returns a resource stream for a site-of-origin data file that is located at the specified <see cref="T:System.Uri" /> (see <see href="https://learn.microsoft.com/dotnet/framework/wpf/app-development/wpf-application-resource-content-and-data-files">WPF Application Resource, Content, and Data Files</see>).</summary>
<returns>A <see cref="T:System.Windows.Resources.StreamResourceInfo" /> that contains a resource stream for a site-of-origin data file that is located at the specified <see cref="T:System.Uri" />. If the loose resource is not found, <see langword="null" /> is returned.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is not thread safe.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <see cref="T:System.Uri" /> that is passed to <see cref="M:System.Windows.Application.GetRemoteStream(System.Uri)" /> is null.</exception>
<exception cref="T:System.ArgumentException">The <see cref="T:System.Uri" /> that is passed to <see cref="M:System.Windows.Application.GetRemoteStream(System.Uri)" /> is either not relative, or is absolute but not in the <c>pack://siteoforigin:,,,/</c> form.</exception>
<altmember cref="M:System.Windows.Application.GetContentStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetResourceStream(System.Uri)" />
<altmember cref="Overload:System.Windows.Application.LoadComponent" />
</Docs>
</Member>
<Member MemberName="GetResourceStream">
<MemberSignature Language="C#" Value="public static System.Windows.Resources.StreamResourceInfo GetResourceStream (Uri uriResource);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Windows.Resources.StreamResourceInfo GetResourceStream(class System.Uri uriResource) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Application.GetResourceStream(System.Uri)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetResourceStream (uriResource As Uri) As StreamResourceInfo" />
<MemberSignature Language="F#" Value="static member GetResourceStream : Uri -> System.Windows.Resources.StreamResourceInfo" Usage="System.Windows.Application.GetResourceStream uriResource" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Windows::Resources::StreamResourceInfo ^ GetResourceStream(Uri ^ uriResource);" />
<MemberType>Method</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 FrameworkAlternate="netframework-3.0;netframework-3.5;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">
<AttributeName Language="C#">[System.Security.SecurityCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecurityCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Resources.StreamResourceInfo</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="uriResource" Type="System.Uri" />
</Parameters>
<Docs>
<param name="uriResource">The <see cref="T:System.Uri" /> that maps to an embedded resource.</param>
<summary>Returns a resource stream for a resource data file that is located at the specified <see cref="T:System.Uri" /> (see <see href="https://learn.microsoft.com/dotnet/framework/wpf/app-development/wpf-application-resource-content-and-data-files">WPF Application Resource, Content, and Data Files</see>).</summary>
<returns>A <see cref="T:System.Windows.Resources.StreamResourceInfo" /> that contains a resource stream for resource data file that is located at the specified <see cref="T:System.Uri" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is not thread safe.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <see cref="T:System.Uri" /> that is passed to <see cref="M:System.Windows.Application.GetResourceStream(System.Uri)" /> is null.</exception>
<exception cref="T:System.ArgumentException">The <see cref="T:System.Uri" /> that is passed to <see cref="M:System.Windows.Application.GetResourceStream(System.Uri)" /> is either not relative, or is absolute but not in the <c>pack://application:,,,/</c> form.</exception>
<exception cref="T:System.IO.IOException">The <see cref="T:System.Uri" /> that is passed to <see cref="M:System.Windows.Application.GetResourceStream(System.Uri)" /> cannot be found.</exception>
<altmember cref="M:System.Windows.Application.GetContentStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetRemoteStream(System.Uri)" />
<altmember cref="Overload:System.Windows.Application.LoadComponent" />
</Docs>
</Member>
<Member MemberName="LoadCompleted">
<MemberSignature Language="C#" Value="public event System.Windows.Navigation.LoadCompletedEventHandler LoadCompleted;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Navigation.LoadCompletedEventHandler LoadCompleted" />
<MemberSignature Language="DocId" Value="E:System.Windows.Application.LoadCompleted" />
<MemberSignature Language="VB.NET" Value="Public Custom Event LoadCompleted As LoadCompletedEventHandler " FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.LoadCompleted : System.Windows.Navigation.LoadCompletedEventHandler " Usage="member this.LoadCompleted : System.Windows.Navigation.LoadCompletedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::Navigation::LoadCompletedEventHandler ^ LoadCompleted;" />
<MemberSignature Language="VB.NET" Value="Public Event LoadCompleted As LoadCompletedEventHandler " FrameworkAlternate="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" />
<MemberType>Event</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>
<ReturnValue>
<ReturnType>System.Windows.Navigation.LoadCompletedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when content that was navigated to by a navigator in the application has been loaded, parsed, and has begun rendering.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A navigator is either a <xref:System.Windows.Navigation.NavigationWindow> or a <xref:System.Windows.Controls.Frame>.
See <xref:System.Windows.Navigation.NavigationService.LoadCompleted?displayProperty=nameWithType>.
> [!NOTE]
> Listen for events on the navigated content such as the <xref:System.Windows.FrameworkElement.Loaded> event on <xref:System.Windows.Controls.Page> before you access properties of the navigated content.
]]></format>
</remarks>
<altmember cref="E:System.Windows.Application.Navigated" />
<altmember cref="E:System.Windows.Application.Navigating" />
<altmember cref="E:System.Windows.Application.NavigationProgress" />
<altmember cref="E:System.Windows.Application.NavigationStopped" />
<altmember cref="E:System.Windows.Application.NavigationFailed" />
<altmember cref="E:System.Windows.Application.FragmentNavigation" />
</Docs>
</Member>
<MemberGroup MemberName="LoadComponent">
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Loads a XAML file that is located at the specified uniform resource identifier (URI).</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The XAML file can be an application code file (configured as an Microsoft build engine (MSBuild) Page item) or an application data file (a resource file, content file, or site-of-origin file; see [WPF Application Resource, Content, and Data Files](/dotnet/framework/wpf/app-development/wpf-application-resource-content-and-data-files)).
> [!NOTE]
> This method is not thread-safe.
]]></format>
</remarks>
<altmember cref="M:System.Windows.Application.GetResourceStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetContentStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetRemoteStream(System.Uri)" />
</Docs>
</MemberGroup>
<Member MemberName="LoadComponent">
<MemberSignature Language="C#" Value="public static object LoadComponent (Uri resourceLocator);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig object LoadComponent(class System.Uri resourceLocator) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Application.LoadComponent(System.Uri)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function LoadComponent (resourceLocator As Uri) As Object" />
<MemberSignature Language="F#" Value="static member LoadComponent : Uri -> obj" Usage="System.Windows.Application.LoadComponent resourceLocator" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Object ^ LoadComponent(Uri ^ resourceLocator);" />
<MemberType>Method</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>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="resourceLocator" Type="System.Uri" />
</Parameters>
<Docs>
<param name="resourceLocator">A <see cref="T:System.Uri" /> that maps to a relative XAML file.</param>
<summary>Loads a XAML file that is located at the specified uniform resource identifier (URI), and converts it to an instance of the object that is specified by the root element of the XAML file.</summary>
<returns>An instance of the root element specified by the XAML file loaded.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You must explicitly convert the return value to the same type as the root element of the XAML file.
The XAML file can be an application code file (configured as an Microsoft build engine (MSBuild) Page item) or an application data file (a resource file, content file, or site-of-origin file; see [WPF Application Resource, Content, and Data Files](/dotnet/framework/wpf/app-development/wpf-application-resource-content-and-data-files)).
> [!NOTE]
> This method is not thread-safe.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="resourceLocator" /> is null.</exception>
<exception cref="T:System.ArgumentException">The <paramref name="resourceLocator" /> is an absolute URI.</exception>
<exception cref="T:System.Exception">The file is not a XAML file.</exception>
<altmember cref="M:System.Windows.Application.GetResourceStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetContentStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetRemoteStream(System.Uri)" />
</Docs>
</Member>
<Member MemberName="LoadComponent">
<MemberSignature Language="C#" Value="public static void LoadComponent (object component, Uri resourceLocator);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void LoadComponent(object component, class System.Uri resourceLocator) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Application.LoadComponent(System.Object,System.Uri)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub LoadComponent (component As Object, resourceLocator As Uri)" />
<MemberSignature Language="F#" Value="static member LoadComponent : obj * Uri -> unit" Usage="System.Windows.Application.LoadComponent (component, resourceLocator)" />
<MemberSignature Language="C++ CLI" Value="public:
 static void LoadComponent(System::Object ^ component, Uri ^ resourceLocator);" />
<MemberType>Method</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 FrameworkAlternate="netframework-3.0;netframework-3.5;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">
<AttributeName Language="C#">[System.Security.SecurityCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecurityCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="component" Type="System.Object" />
<Parameter Name="resourceLocator" Type="System.Uri" />
</Parameters>
<Docs>
<param name="component">An object of the same type as the root element of the XAML file.</param>
<param name="resourceLocator">A <see cref="T:System.Uri" /> that maps to a relative XAML file.</param>
<summary>Loads a XAML file that is located at the specified uniform resource identifier (URI) and converts it to an instance of the object that is specified by the root element of the XAML file.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The XAML file can be an application code file (configured as an Microsoft build engine (MSBuild) Page item) or an application data file (a resource file, content file, or site-of-origin file; see [WPF Application Resource, Content, and Data Files](/dotnet/framework/wpf/app-development/wpf-application-resource-content-and-data-files)).
> [!NOTE]
> This method is not thread-safe.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="resourceLocator" /> is null.</exception>
<exception cref="T:System.ArgumentException">The <paramref name="resourceLocator" /> is an absolute URI.</exception>
<exception cref="T:System.Exception">
<paramref name="component" /> is of a type that does not match the root element of the XAML file.</exception>
<altmember cref="M:System.Windows.Application.GetResourceStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetContentStream(System.Uri)" />
<altmember cref="M:System.Windows.Application.GetRemoteStream(System.Uri)" />
</Docs>
</Member>
<Member MemberName="MainWindow">
<MemberSignature Language="C#" Value="public System.Windows.Window MainWindow { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Window MainWindow" />
<MemberSignature Language="DocId" Value="P:System.Windows.Application.MainWindow" />
<MemberSignature Language="VB.NET" Value="Public Property MainWindow As Window" />
<MemberSignature Language="F#" Value="member this.MainWindow : System.Windows.Window with get, set" Usage="System.Windows.Application.MainWindow" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Windows::Window ^ MainWindow { System::Windows::Window ^ get(); void set(System::Windows::Window ^ 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>
<ReturnValue>
<ReturnType>System.Windows.Window</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the main window of the application.</summary>
<value>A <see cref="T:System.Windows.Window" /> that is designated as the main application window.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Application.MainWindow%2A> is automatically set with a reference to the first <xref:System.Windows.Window> object to be instantiated in the <xref:System.AppDomain>.
You can specify a different main window by setting <xref:System.Windows.Application.MainWindow%2A> assigning another <xref:System.Windows.Application.Windows%2A> object to the <xref:System.Windows.Application.MainWindow%2A> property.
If the <xref:System.Windows.Application.ShutdownMode%2A> property of the <xref:System.Windows.Application> object is set to <xref:System.Windows.ShutdownMode.OnMainWindowClose>, closing the main window causes the application to shut down.
It is possible to set the <xref:System.Windows.Application.MainWindow%2A> property from XAML, if an application's main window is not the window that is produced by setting the <xref:System.Windows.Application.StartupUri%2A> property in XAML. The two limitations of the XAML approach are:
- You can specify either a XAML-only <xref:System.Windows.Window> or a XAML-only <xref:System.Windows.Navigation.NavigationWindow> as the main window.
- You must set the <xref:System.Windows.UIElement.Visibility%2A> property of the window you specify, otherwise it won't be shown.
The reference to the first <xref:System.Windows.Window> object to be instantiated is also added as the first item to the <xref:System.Windows.Application.Windows%2A> collection. If <xref:System.Windows.Application.MainWindow%2A> is subsequently set with a reference to a different <xref:System.Windows.Window>, the position of the item with the reference to the main window will change, while the order of items in <xref:System.Windows.Application.Windows%2A> remains the same. Consequently, always use <xref:System.Windows.Application.MainWindow%2A> to refer to the main window instead of the first item in <xref:System.Windows.Application.Windows%2A>.
> [!NOTE]
> If the main window is a <xref:System.Windows.Navigation.NavigationWindow>, and you need specific access to <xref:System.Windows.Navigation.NavigationWindow> members, you will need to cast the value of <xref:System.Windows.Application.MainWindow%2A> to <xref:System.Windows.Navigation.NavigationWindow>.
>
> This property is available only from the thread that created the <xref:System.Windows.Application> object.
## Examples
The following example shows how to find the main application window.
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/MainWindow/App.xaml.cs" id="Snippetgetapplicationmainwindowcode":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ApplicationMainWindowSnippets/visualbasic/application.xaml.vb" id="Snippetgetapplicationmainwindowcode":::
The following example shows how to set <xref:System.Windows.Application.MainWindow%2A> using XAML.
:::code language="xaml" source="~/snippets/xaml/VS_Snippets_Wpf/ApplicationMainWindowSnippets/XAML/App.xaml" id="Snippetsetapplicationmainwindowxaml":::
The following example shows how to instantiate the <xref:System.Windows.Application.MainWindow%2A> in code during application startup.
:::code language="csharp" source="~/snippets/csharp/System.Windows/Application/MainWindow/App1.xaml.cs" id="Snippetfirstwindowusingcodecodebehind":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/HOWTOWindowManagementSnippets/visualbasic/application.xaml.vb" id="Snippetfirstwindowusingcodecodebehind":::
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">
<see cref="P:System.Windows.Application.MainWindow" /> is set from an application that's hosted in a browser, such as an XAML browser applications (XBAPs).</exception>
<altmember cref="E:System.Windows.Application.Exit" />
</Docs>
</Member>
<Member MemberName="Navigated">
<MemberSignature Language="C#" Value="public event System.Windows.Navigation.NavigatedEventHandler Navigated;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Navigation.NavigatedEventHandler Navigated" />
<MemberSignature Language="DocId" Value="E:System.Windows.Application.Navigated" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Navigated As NavigatedEventHandler " FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.Navigated : System.Windows.Navigation.NavigatedEventHandler " Usage="member this.Navigated : System.Windows.Navigation.NavigatedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::Navigation::NavigatedEventHandler ^ Navigated;" />
<MemberSignature Language="VB.NET" Value="Public Event Navigated As NavigatedEventHandler " FrameworkAlternate="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" />
<MemberType>Event</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>
<ReturnValue>
<ReturnType>System.Windows.Navigation.NavigatedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the content that is being navigated to by a navigator in the application has been found, although it may not have completed loading.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A navigator is either a <xref:System.Windows.Navigation.NavigationWindow> or a <xref:System.Windows.Controls.Frame>.
See <xref:System.Windows.Navigation.NavigationService.NavigationFailed?displayProperty=nameWithType>.
]]></format>
</remarks>
<altmember cref="E:System.Windows.Application.Navigating" />
<altmember cref="E:System.Windows.Application.LoadCompleted" />
<altmember cref="E:System.Windows.Application.NavigationProgress" />
<altmember cref="E:System.Windows.Application.NavigationStopped" />
<altmember cref="E:System.Windows.Application.NavigationFailed" />
<altmember cref="E:System.Windows.Application.FragmentNavigation" />
</Docs>
</Member>
<Member MemberName="Navigating">
<MemberSignature Language="C#" Value="public event System.Windows.Navigation.NavigatingCancelEventHandler Navigating;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Navigation.NavigatingCancelEventHandler Navigating" />
<MemberSignature Language="DocId" Value="E:System.Windows.Application.Navigating" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Navigating As NavigatingCancelEventHandler " FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.Navigating : System.Windows.Navigation.NavigatingCancelEventHandler " Usage="member this.Navigating : System.Windows.Navigation.NavigatingCancelEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::Navigation::NavigatingCancelEventHandler ^ Navigating;" />
<MemberSignature Language="VB.NET" Value="Public Event Navigating As NavigatingCancelEventHandler " FrameworkAlternate="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" />
<MemberType>Event</MemberType>