/
Window.xml
2659 lines (2307 loc) · 172 KB
/
Window.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="Window" FullName="System.Windows.Window">
<TypeSignature Language="C#" Value="public class Window : System.Windows.Controls.ContentControl" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi Window extends System.Windows.Controls.ContentControl" />
<TypeSignature Language="DocId" Value="T:System.Windows.Window" />
<TypeSignature Language="VB.NET" Value="Public Class Window
Inherits ContentControl" />
<TypeSignature Language="C++ CLI" Value="public ref class Window : System::Windows::Controls::ContentControl" />
<TypeSignature Language="F#" Value="type Window = class
 inherit ContentControl" />
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Windows.Controls.ContentControl</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>System.Windows.Localizability(System.Windows.LocalizationCategory.Ignore)</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides the ability to create, configure, show, and manage the lifetime of windows and dialog boxes.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The point of interaction between a user and a standalone application is a window. A [!INCLUDE[TLA#tla_winclient](~/includes/tlasharptla-winclient-md.md)] window consists of two distinct areas:
- A non-client area, which hosts the windows adornments, including an icon, title, System menu, minimize button, maximize button, restore button, close button, and a border.
- A client area, which hosts application-specific content.
A standard window is shown in the following figure:
![Window elements](~/add/media/windowoverviewfigure1.PNG "Window elements")
<xref:System.Windows.Window> encapsulates the ability to create, configure, show, and manage the lifetime of both windows and dialog boxes, and provides the following key services:
**Lifetime Management**: <xref:System.Windows.Window.Activate%2A>, <xref:System.Windows.Window.Activated>, <xref:System.Windows.Window.Close%2A>, <xref:System.Windows.Window.Closed>, <xref:System.Windows.Window.Closing>, <xref:System.Windows.Window.Deactivated>, <xref:System.Windows.Window.Hide%2A>, <xref:System.Windows.Window.IsActive%2A>, <xref:System.Windows.Window.Show%2A>, <xref:System.Windows.Window.SourceInitialized>.
**Window Management**: <xref:System.Windows.Window.GetWindow%2A>, <xref:System.Windows.Window.OwnedWindows%2A>, <xref:System.Windows.Window.Owner%2A>.
**Appearance and Behavior**: <xref:System.Windows.Window.AllowsTransparency%2A>, <xref:System.Windows.Window.ContentRendered>, <xref:System.Windows.Window.DragMove%2A>, <xref:System.Windows.Window.Icon%2A>, <xref:System.Windows.Window.Left%2A>, <xref:System.Windows.Window.LocationChanged>, <xref:System.Windows.Window.ResizeMode%2A>, <xref:System.Windows.Window.RestoreBounds%2A>, <xref:System.Windows.Window.ShowActivated%2A>, <xref:System.Windows.Window.ShowInTaskbar%2A>, <xref:System.Windows.Window.SizeToContent%2A>, <xref:System.Windows.Window.StateChanged>, <xref:System.Windows.Window.Title%2A>, <xref:System.Windows.Window.Top%2A>, <xref:System.Windows.Window.Topmost%2A>, <xref:System.Windows.Window.WindowStartupLocation%2A>, <xref:System.Windows.Window.WindowState%2A>, <xref:System.Windows.Window.WindowStyle%2A>
**Dialog Boxes**: <xref:System.Windows.Window.DialogResult%2A>, <xref:System.Windows.Window.ShowDialog%2A>.
Additionally, <xref:System.Windows.Application> exposes special support for managing all of the windows in an application:
- Application maintains a list of all the windows that are currently instantiated in the application. This list is exposed by the <xref:System.Windows.Application.Windows%2A> property.
- By default, <xref:System.Windows.Application.MainWindow%2A> is automatically set with a reference to the first <xref:System.Windows.Window> that is instantiated in an application. This thereby making the window the main application window.
A <xref:System.Windows.Window> can be implemented using markup, markup and code-behind, or code.
<xref:System.Windows.Window> is primarily used to display windows and dialog boxes for standalone applications. However, for applications that require navigation at the window level, such as wizards, you can use <xref:System.Windows.Navigation.NavigationWindow> instead; <xref:System.Windows.Navigation.NavigationWindow> derives from <xref:System.Windows.Window> and extends it with browser-style navigation support.
> [!NOTE]
> Islands of navigable content can be incorporated into other content and content containers using <xref:System.Windows.Controls.Frame>.
<xref:System.Windows.Window> needs `UnmanagedCode` security permission to be instantiated. This has the following consequences:
- [!INCLUDE[TLA#tla_clickonce](~/includes/tlasharptla-clickonce-md.md)]-deployed standalone applications will request permission elevation when launched from either the Internet or Local Intranet zones.
- [!INCLUDE[TLA2#tla_xbap#plural](~/includes/tla2sharptla-xbapsharpplural-md.md)] that request anything less than full permissions will not be able to instantiate windows or dialog boxes.
For information about standalone application deployment and security considerations, see [WPF Security Strategy - Platform Security](~/docs/framework/wpf/wpf-security-strategy-platform-security.md).
A <xref:System.Windows.Window> is a <xref:System.Windows.Controls.ContentControl>, which means that it can contain a single object of any type (such as a string, an image, or a panel). For more information, see the <xref:System.Windows.Controls.ContentControl> class. Also, <xref:System.Windows.Window> is a root element and, therefore, cannot be part of another element's content.
> [!NOTE]
> The <xref:System.Windows.FrameworkElement.Height%2A>, <xref:System.Windows.FrameworkElement.Width%2A>, <xref:System.Windows.Window.Top%2A>, and <xref:System.Windows.Window.Left%2A> properties set on a <xref:System.Windows.Window> through a style will not be applied at run time.
## Customizing the Window Control
To apply the same property settings to multiple <xref:System.Windows.Window> controls, use the <xref:System.Windows.FrameworkElement.Style%2A> property. You can modify the default <xref:System.Windows.Controls.ControlTemplate> to give the control a unique appearance. For more information about creating a <xref:System.Windows.Controls.ControlTemplate>, see [Customizing the Appearance of an Existing Control by Creating a ControlTemplate](~/docs/framework/wpf/controls/customizing-the-appearance-of-an-existing-control.md). To see the parts and states that are specific to the <xref:System.Windows.Window>, see [Window Styles and Templates](~/docs/framework/wpf/controls/window-styles-and-templates.md).
Dependency properties for this control might be set by the control's default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see [Default WPF Themes](https://go.microsoft.com/fwlink/?LinkID=158252).
[!INCLUDE[setting-a-visual-property](~/includes/visual-property-note.md)]
## Examples
The following example shows how a standard window is defined using only markup:
[!code-xaml[WindowSnippets#WindowMARKUPONLY](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowSnippets/CSharp/MarkupOnlyWindow.xaml#windowmarkuponly)]
The following example shows how a standard window is defined using only code:
[!code-csharp[WindowSnippets#WindowCODEONLY](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowSnippets/CSharp/CodeOnlyWindow.cs#windowcodeonly)]
[!code-vb[WindowSnippets#WindowCODEONLY](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WindowSnippets/visualbasic/codeonlywindow.vb#windowcodeonly)]
The following example shows how a standard window is defined using a combination of markup and code-behind.
[!code-xaml[WindowSnippets#WindowXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowSnippets/CSharp/MainWindow.xaml#windowxaml)]
[!code-csharp[WindowSnippets#WindowCODEBEHIND](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowSnippets/CSharp/MainWindow.xaml.cs#windowcodebehind)]
[!code-vb[WindowSnippets#WindowCODEBEHIND](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WindowSnippets/visualbasic/mainwindow.xaml.vb#windowcodebehind)]
]]></format>
</remarks>
<altmember cref="M:System.Windows.Window.Show" />
<altmember cref="M:System.Windows.Window.ShowDialog" />
<altmember cref="P:System.Windows.Window.DialogResult" />
<altmember cref="T:System.Windows.Application" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Window ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Window.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 Window();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.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;netcore-3.0">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Window" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The constructor initializes the <xref:System.Windows.FrameworkElement.Width%2A>, <xref:System.Windows.FrameworkElement.Height%2A>, <xref:System.Windows.Window.Top%2A>, and <xref:System.Windows.Window.Left%2A> properties to their default <xref:System.Windows.Window> values.
If a window is created within an <xref:System.AppDomain> that has an <xref:System.Windows.Application> object, the constructor adds the <xref:System.Windows.Window> object to the set of <xref:System.Windows.Application>-managed windows via the <xref:System.Windows.Application.Windows%2A> property of the <xref:System.Windows.Application> object.
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.SecurityPermission">for permission for this object to call unsafe native methods. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
</Docs>
</Member>
<Member MemberName="Activate">
<MemberSignature Language="C#" Value="public bool Activate ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Activate() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Window.Activate" />
<MemberSignature Language="VB.NET" Value="Public Function Activate () As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:
 bool Activate();" />
<MemberSignature Language="F#" Value="member this.Activate : unit -> bool" Usage="window.Activate " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.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;netcore-3.0">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Attempts to bring the window to the foreground and activates it.</summary>
<returns>
<see langword="true" /> if the <see cref="T:System.Windows.Window" /> was successfully activated; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The rules that determine whether the window is activated are the same as those used by the [!INCLUDE[TLA2#tla_win32](~/includes/tla2sharptla-win32-md.md)] `SetForegroundWindow` function (User32.dll).
If the window is activated in a Windows Presentation Foundation application that is not the user's foreground application, <xref:System.Windows.Application.Activated> event is raised.
> [!NOTE]
> This method cannot be called when a window is hosted in a browser.
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.UIPermission">for permission to activate a window. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.AllWindows" /></permission>
<altmember cref="E:System.Windows.Window.Activated" />
<altmember cref="E:System.Windows.Window.Deactivated" />
<altmember cref="P:System.Windows.Window.IsActive" />
</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.Window.Activated" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Activated As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event EventHandler ^ Activated;" />
<MemberSignature Language="F#" Value="member this.Activated : EventHandler " Usage="member this.Activated : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when a window becomes the foreground window.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A window is activated (becomes the foreground window) when:
- The window is first opened.
- A user switches to a window by selecting it with the mouse, pressing ALT+TAB, or from Task Manager.
- A user clicks the window's taskbar button.
Windows that need to detect when they become activate can handle the <xref:System.Windows.Window.Activated> event.
After a window 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 inspect <xref:System.Windows.Window.IsActive%2A> to determine which activation state it's in.
An application can also be <xref:System.Windows.Application.Activated>.
]]></format>
</remarks>
<altmember cref="E:System.Windows.Window.Deactivated" />
<altmember cref="M:System.Windows.Window.Activate" />
<altmember cref="P:System.Windows.Window.IsActive" />
</Docs>
</Member>
<Member MemberName="AllowsTransparency">
<MemberSignature Language="C#" Value="public bool AllowsTransparency { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool AllowsTransparency" />
<MemberSignature Language="DocId" Value="P:System.Windows.Window.AllowsTransparency" />
<MemberSignature Language="VB.NET" Value="Public Property AllowsTransparency As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool AllowsTransparency { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.AllowsTransparency : bool with get, set" Usage="System.Windows.Window.AllowsTransparency" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value that indicates whether a window's client area supports transparency.</summary>
<value>
<see langword="true" /> if the window supports transparency; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When the <xref:System.Windows.Controls.Control.Background%2A> property of a window is set to a transparent color, using <xref:System.Windows.Media.Brushes.Transparent%2A> for example, the window remains opaque. This means that the desktop and any running applications "beneath" the window cannot be seen. To enable this type of transparency, <xref:System.Windows.Window.AllowsTransparency%2A> must be set to `true`.
<xref:System.Windows.Window.AllowsTransparency%2A> exists to facilitate the creation of non-rectangular windows, and, consequently, when <xref:System.Windows.Window.AllowsTransparency%2A> is set to `true`, a window's <xref:System.Windows.Window.WindowStyle%2A> property must be set to <xref:System.Windows.WindowStyle.None>.
<a name="dependencyPropertyInfo_WindowAllowsTransparency"></a>
## Dependency Property Information
|||
|-|-|
|Identifier field|<xref:System.Windows.Window.AllowsTransparencyProperty>|
|Metadata properties set to `true`|None|
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">A window that has a <see cref="P:System.Windows.Window.WindowStyle" /> value of anything other than <see cref="F:System.Windows.WindowStyle.None" />.</exception>
</Docs>
</Member>
<Member MemberName="AllowsTransparencyProperty">
<MemberSignature Language="C#" Value="public static readonly System.Windows.DependencyProperty AllowsTransparencyProperty;" />
<MemberSignature Language="ILAsm" Value=".field public static initonly class System.Windows.DependencyProperty AllowsTransparencyProperty" />
<MemberSignature Language="DocId" Value="F:System.Windows.Window.AllowsTransparencyProperty" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly AllowsTransparencyProperty As DependencyProperty " />
<MemberSignature Language="C++ CLI" Value="public: static initonly System::Windows::DependencyProperty ^ AllowsTransparencyProperty;" />
<MemberSignature Language="F#" Value=" staticval mutable AllowsTransparencyProperty : System.Windows.DependencyProperty" Usage="System.Windows.Window.AllowsTransparencyProperty" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.DependencyProperty</ReturnType>
</ReturnValue>
<Docs>
<summary>Identifies the <see cref="P:System.Windows.Window.AllowsTransparency" /> dependency property.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="ArrangeOverride">
<MemberSignature Language="C#" Value="protected override System.Windows.Size ArrangeOverride (System.Windows.Size arrangeBounds);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance valuetype System.Windows.Size ArrangeOverride(valuetype System.Windows.Size arrangeBounds) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Window.ArrangeOverride(System.Windows.Size)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function ArrangeOverride (arrangeBounds As Size) As Size" />
<MemberSignature Language="C++ CLI" Value="protected:
 override System::Windows::Size ArrangeOverride(System::Windows::Size arrangeBounds);" />
<MemberSignature Language="F#" Value="override this.ArrangeOverride : System.Windows.Size -> System.Windows.Size" Usage="window.ArrangeOverride arrangeBounds" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Size</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="arrangeBounds" Type="System.Windows.Size" />
</Parameters>
<Docs>
<param name="arrangeBounds">A <see cref="T:System.Windows.Size" /> that reflects the final size that the window should use to arrange itself and its children.</param>
<summary>Override this method to arrange and size a window and its child elements.</summary>
<returns>A <see cref="T:System.Windows.Size" /> that reflects the actual size that was used.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Window.ArrangeOverride%2A> is not called when the <xref:System.Windows.UIElement.Visibility%2A> property has a value of <xref:System.Windows.Visibility.Collapsed>. If the value of the <xref:System.Windows.UIElement.Visibility%2A> property is either <xref:System.Windows.Visibility.Hidden> or <xref:System.Windows.Visibility.Visible>, <xref:System.Windows.Window.ArrangeOverride%2A> is called.
> [!NOTE]
> When either <xref:System.Windows.Window.Show%2A> or <xref:System.Windows.Window.ShowDialog%2A> are called, the <xref:System.Windows.UIElement.Visibility%2A> property of a <xref:System.Windows.Window> is set to <xref:System.Windows.Visibility.Visible>.
]]></format>
</remarks>
<altmember cref="M:System.Windows.FrameworkElement.ArrangeOverride(System.Windows.Size)" />
<altmember cref="M:System.Windows.Window.MeasureOverride(System.Windows.Size)" />
</Docs>
</Member>
<Member MemberName="Close">
<MemberSignature Language="C#" Value="public void Close ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Close() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Window.Close" />
<MemberSignature Language="VB.NET" Value="Public Sub Close ()" />
<MemberSignature Language="C++ CLI" Value="public:
 void Close();" />
<MemberSignature Language="F#" Value="member this.Close : unit -> unit" Usage="window.Close " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.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;netcore-3.0">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Manually closes a <see cref="T:System.Windows.Window" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Windows.Window> can be closed using one of several, well-known, system-provided mechanisms located in its title bar, including:
- ALT+F4.
- System menu | **Close**.
- **Close** button.
A <xref:System.Windows.Window> can also be closed using one of several well-known mechanisms within the client area that are provided by developers, including:
- **File** | **Exit** on a main window.
- **File** | **Close** or a **Close** button on a child window.
> [!NOTE]
> **OK** and **Cancel** buttons on a dialog box are also developer-provided, although will likely set <xref:System.Windows.Window.DialogResult%2A>, which automatically closes a window that was opened by calling <xref:System.Windows.Window.ShowDialog%2A>.
These mechanisms require you to explicitly call <xref:System.Windows.Window.Close%2A> to close a window.
> [!NOTE]
> If a window, opened by calling <xref:System.Windows.Window.ShowDialog%2A>, and with a <xref:System.Windows.Controls.Button> with its <xref:System.Windows.Controls.Button.IsCancel%2A> property set to true, will automatically close when the button is either clicked, or ESC is pressed. If the window was opened using <xref:System.Windows.Window.Show%2A>, however, <xref:System.Windows.Window.Close%2A> must be explicitly called, such as from <xref:System.Windows.Controls.Primitives.ButtonBase.Click> event handler for the <xref:System.Windows.Controls.Button>.
Closing a window causes the <xref:System.Windows.Window.Closing> event to be raised. If the <xref:System.Windows.Window.Closing> event isn't canceled, the following occurs:
- The <xref:System.Windows.Window> is removed from <xref:System.Windows.Application.Windows%2A?displayProperty=nameWithType> (if an <xref:System.Windows.Application> object exists).
- The <xref:System.Windows.Window> is removed from the owner <xref:System.Windows.Window> if the owner/owned relationship was established before the owned <xref:System.Windows.Window> was shown and after the owner <xref:System.Windows.Window> was opened.
- The <xref:System.Windows.Window.Closed> event is raised.
- Unmanaged resources created by the <xref:System.Windows.Window> are disposed.
- If <xref:System.Windows.Window.ShowDialog%2A> was called to show the <xref:System.Windows.Window>, <xref:System.Windows.Window.ShowDialog%2A> returns.
Closing a <xref:System.Windows.Window> causes any windows that it owns to be closed. Furthermore, closing a <xref:System.Windows.Window> may cause an application to stop running depending on how the <xref:System.Windows.Application.ShutdownMode%2A?displayProperty=nameWithType> property is set.
> [!NOTE]
> This method cannot be called when a window is hosted in a browser.
## Examples
The following example shows a **File** | **Exit** menu being handled to explicitly call <xref:System.Windows.Window.Close%2A>.
[!code-xaml[WindowCloseSnippets#WindowCloseXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowCloseSnippets/CSharp/MainWindow.xaml#windowclosexaml)]
[!code-csharp[WindowCloseSnippets#WindowCloseCODEBEHIND](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowCloseSnippets/CSharp/MainWindow.xaml.cs#windowclosecodebehind)]
[!code-vb[WindowCloseSnippets#WindowCloseCODEBEHIND](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WindowCloseSnippets/visualbasic/mainwindow.xaml.vb#windowclosecodebehind)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.UIPermission">for permission to use all windows and user input events without restriction. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.AllWindows" /></permission>
<altmember cref="M:System.Windows.Window.Show" />
<altmember cref="M:System.Windows.Window.ShowDialog" />
<altmember cref="P:System.Windows.Window.DialogResult" />
<altmember cref="P:System.Windows.Window.Owner" />
<altmember cref="P:System.Windows.Window.OwnedWindows" />
</Docs>
</Member>
<Member MemberName="Closed">
<MemberSignature Language="C#" Value="public event EventHandler Closed;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Closed" />
<MemberSignature Language="DocId" Value="E:System.Windows.Window.Closed" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Closed As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event EventHandler ^ Closed;" />
<MemberSignature Language="F#" Value="member this.Closed : EventHandler " Usage="member this.Closed : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the window is about to close.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Once this event is raised, a window cannot be prevented from closing.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">
<see cref="P:System.Windows.UIElement.Visibility" /> is set, or <see cref="M:System.Windows.Window.Show" />, <see cref="M:System.Windows.Window.ShowDialog" />, or <see cref="M:System.Windows.Window.Hide" /> is called while a window is closing.</exception>
<altmember cref="M:System.Windows.Window.Close" />
<altmember cref="E:System.Windows.Window.Closing" />
<altmember cref="M:System.Windows.Application.Shutdown" />
<altmember cref="P:System.Windows.Application.ShutdownMode" />
<altmember cref="E:System.Windows.Application.SessionEnding" />
</Docs>
</Member>
<Member MemberName="Closing">
<MemberSignature Language="C#" Value="public event System.ComponentModel.CancelEventHandler Closing;" />
<MemberSignature Language="ILAsm" Value=".event class System.ComponentModel.CancelEventHandler Closing" />
<MemberSignature Language="DocId" Value="E:System.Windows.Window.Closing" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Closing As CancelEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::ComponentModel::CancelEventHandler ^ Closing;" />
<MemberSignature Language="F#" Value="member this.Closing : System.ComponentModel.CancelEventHandler " Usage="member this.Closing : System.ComponentModel.CancelEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.ComponentModel.CancelEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs directly after <see cref="M:System.Windows.Window.Close" /> is called, and can be handled to cancel window closure.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Window.Closing> can be handled to detect when a window is being closed (for example, when <xref:System.Windows.Window.Close%2A> is called). Furthermore, <xref:System.Windows.Window.Closing> can be used to prevent a window from closing. To prevent a window from closing, you can set the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.ComponentModel.CancelEventArgs> argument to `true`.
The <xref:System.Windows.Window.Closing> event is raised when <xref:System.Windows.Window.Close%2A> is called, if a window's Close button is clicked, or if the user presses ALT+F4.
If an owned window was opened by its owner window using <xref:System.Windows.Window.Show%2A>, and the owner window is closed, the owned window's <xref:System.Windows.Window.Closing> event is not raised. If the owner of a window is closed (see <xref:System.Windows.Window.Owner%2A>), <xref:System.Windows.Window.Closing> is not raised on the owned window.
If <xref:System.Windows.Application.Shutdown%2A> is called, the <xref:System.Windows.Window.Closing> event for each window is raised. However, if <xref:System.Windows.Window.Closing> is canceled, cancellation is ignored.
If a session ends because a user logs off or shuts down, <xref:System.Windows.Window.Closing> is not raised; handle <xref:System.Windows.Application.SessionEnding> to implement code that cancels application closure.
If you want to show and hide a window multiple times during the lifetime of an application, and you don't want to reinstantiate the window each time you show it, you can handle the <xref:System.Windows.Window.Closing> event, cancel it, and call the <xref:System.Windows.Window.Hide%2A> method. Then, you can call <xref:System.Windows.Window.Show%2A> on the same instance to reopen it.
## Examples
The following example demonstrates a <xref:System.Windows.Window> that determines whether it needs user intervention to close.
[!code-xaml[WindowClosingSnippets#WindowClosingXAML1](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowClosingSnippets/CSharp/DataWindow.xaml#windowclosingxaml1)]
[!code-csharp[WindowClosingSnippets](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowClosingSnippets/CSharp/DataWindow.xaml.cs)]
[!code-vb[WindowClosingSnippets](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WindowClosingSnippets/visualbasic/datawindow.xaml.vb)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">
<see cref="P:System.Windows.UIElement.Visibility" /> is set, or <see cref="M:System.Windows.Window.Show" />, <see cref="M:System.Windows.Window.ShowDialog" />, or <see cref="M:System.Windows.Window.Close" /> is called while a window is closing.</exception>
<altmember cref="P:System.Windows.Application.ShutdownMode" />
<altmember cref="M:System.Windows.Window.Close" />
<altmember cref="E:System.Windows.Window.Closed" />
</Docs>
</Member>
<Member MemberName="ContentRendered">
<MemberSignature Language="C#" Value="public event EventHandler ContentRendered;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler ContentRendered" />
<MemberSignature Language="DocId" Value="E:System.Windows.Window.ContentRendered" />
<MemberSignature Language="VB.NET" Value="Public Custom Event ContentRendered As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 virtual event EventHandler ^ ContentRendered;" />
<MemberSignature Language="F#" Value="member this.ContentRendered : EventHandler " Usage="member this.ContentRendered : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after a window's content has been rendered.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the window has no content, this event is not raised.
]]></format>
</remarks>
<altmember cref="P:System.Windows.Controls.ContentControl.Content" />
<altmember cref="E:System.Windows.FrameworkElement.Loaded" />
</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.Window.Deactivated" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Deactivated As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event EventHandler ^ Deactivated;" />
<MemberSignature Language="F#" Value="member this.Deactivated : EventHandler " Usage="member this.Deactivated : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when a window becomes a background window.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A window is deactivated (becomes a background window) when:
- A user switches to another window in the current application.
- A user switches to the window in another application by using ALT+TAB or by using Task Manager.
- A user clicks the taskbar button for a window in another application.
Windows that need to detect when they become deactivated by handling the <xref:System.Windows.Window.Deactivated> event.
After a window is first deactivated, it may be reactivated and deactivated many times during its lifetime. If an application's behavior or state depends on its activation state, it can inspect <xref:System.Windows.Window.IsActive%2A> to determine which activation state it's in.
An application can also be <xref:System.Windows.Application.Deactivated>.
]]></format>
</remarks>
<altmember cref="E:System.Windows.Window.Activated" />
<altmember cref="M:System.Windows.Window.Activate" />
<altmember cref="P:System.Windows.Window.IsActive" />
</Docs>
</Member>
<Member MemberName="DialogResult">
<MemberSignature Language="C#" Value="public Nullable<bool> DialogResult { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Nullable`1<bool> DialogResult" />
<MemberSignature Language="DocId" Value="P:System.Windows.Window.DialogResult" />
<MemberSignature Language="VB.NET" Value="Public Property DialogResult As Nullable(Of Boolean)" />
<MemberSignature Language="C++ CLI" Value="public:
 property Nullable<bool> DialogResult { Nullable<bool> get(); void set(Nullable<bool> value); };" />
<MemberSignature Language="F#" Value="member this.DialogResult : Nullable<bool> with get, set" Usage="System.Windows.Window.DialogResult" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.TypeConverter(typeof(System.Windows.DialogResultConverter))</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Nullable<System.Boolean></ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the dialog result value, which is the value that is returned from the <see cref="M:System.Windows.Window.ShowDialog" /> method.</summary>
<value>A <see cref="T:System.Nullable`1" /> value of type <see cref="T:System.Boolean" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Window.DialogResult%2A> can be used from the code that showed a dialog box to determine whether a user accepted (`true`) or canceled (`false`) the dialog box. If a dialog box was accepted, this signifies to the code that opened the dialog box to retrieve the data that was collected by the user and process it. If a dialog box was canceled, however, this signifies that calling code should stop any further processing.
By default, a dialog box is canceled when a user does one of the following:
- PressesALT+F4.
- Clicks the **Close** button.
- Selects **Close** from the System menu.
In all of these cases, <xref:System.Windows.Window.DialogResult%2A> is `false` by default.
A dialog box typically provides a special button to cancel a dialog, which is the button whose <xref:System.Windows.Controls.Button.IsCancel%2A> property is set to `true`. A button configured this way will automatically close a window when either it is pressed, or when the ESC key is pressed. In either of these cases, <xref:System.Windows.Window.DialogResult%2A> remains `false`.
A dialog box also typically provides an accept button, which is the button whose <xref:System.Windows.Controls.Button.IsDefault%2A> property is set to `true`. A button configured this way will raise its <xref:System.Windows.Controls.Primitives.ButtonBase.Click> event when either it or the ENTER key is pressed. However, it won't automatically close the dialog box, nor will it set <xref:System.Windows.Window.DialogResult%2A> to `true`. You need to manually write this code, usually from the <xref:System.Windows.Controls.Primitives.ButtonBase.Click> event handler for the default button.
<xref:System.Windows.Window.DialogResult%2A> is `null` when the dialog box is shown but neither accepted nor canceled.
After a dialog box closes, you can get the dialog result from the value returned by <xref:System.Windows.Window.ShowDialog%2A> method, or by inspecting the <xref:System.Windows.Window.DialogResult%2A> property.
<xref:System.Windows.Window.DialogResult%2A> can only be set when a <xref:System.Windows.Window> is opened by calling its <xref:System.Windows.Window.ShowDialog%2A> method.
> [!NOTE]
> You cannot set or get this property when a window is hosted in a browser.
## Examples
The following example shows how to configure an OK button and a Cancel button to return the appropriate <xref:System.Windows.Window.DialogResult%2A>.
[!code-xaml[WindowDialogResultSnippets#WindowDialogResultXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowDialogResultSnippets/CSharp/DialogBox.xaml#windowdialogresultxaml)]
[!code-csharp[WindowDialogResultSnippets#WindowDialogResultCODEBEHIND](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowDialogResultSnippets/CSharp/DialogBox.xaml.cs#windowdialogresultcodebehind)]
[!code-vb[WindowDialogResultSnippets#WindowDialogResultCODEBEHIND](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WindowDialogResultSnippets/visualbasic/dialogbox.xaml.vb#windowdialogresultcodebehind)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">
<see cref="P:System.Windows.Window.DialogResult" /> is set before a window is opened by calling <see cref="M:System.Windows.Window.ShowDialog" />.
-or-
<see cref="P:System.Windows.Window.DialogResult" /> is set on a window that is opened by calling <see cref="M:System.Windows.Window.Show" />.</exception>
</Docs>
</Member>
<Member MemberName="DpiChanged">
<MemberSignature Language="C#" Value="public event System.Windows.DpiChangedEventHandler DpiChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.DpiChangedEventHandler DpiChanged" />
<MemberSignature Language="DocId" Value="E:System.Windows.Window.DpiChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event DpiChanged As DpiChangedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::DpiChangedEventHandler ^ DpiChanged;" />
<MemberSignature Language="F#" Value="member this.DpiChanged : System.Windows.DpiChangedEventHandler " Usage="member this.DpiChanged : System.Windows.DpiChangedEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.DpiChangedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after the DPI of the screen on which the Window is displayed changes.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="DpiChangedEvent">
<MemberSignature Language="C#" Value="public static readonly System.Windows.RoutedEvent DpiChangedEvent;" />
<MemberSignature Language="ILAsm" Value=".field public static initonly class System.Windows.RoutedEvent DpiChangedEvent" />
<MemberSignature Language="DocId" Value="F:System.Windows.Window.DpiChangedEvent" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly DpiChangedEvent As RoutedEvent " />
<MemberSignature Language="C++ CLI" Value="public: static initonly System::Windows::RoutedEvent ^ DpiChangedEvent;" />
<MemberSignature Language="F#" Value=" staticval mutable DpiChangedEvent : System.Windows.RoutedEvent" Usage="System.Windows.Window.DpiChangedEvent" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.RoutedEvent</ReturnType>
</ReturnValue>
<Docs>
<summary>A <see cref="T:System.Windows.RoutedEvent" /> for when the DPI of the screen the Window is on changes.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="DragMove">
<MemberSignature Language="C#" Value="public void DragMove ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void DragMove() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Window.DragMove" />
<MemberSignature Language="VB.NET" Value="Public Sub DragMove ()" />
<MemberSignature Language="C++ CLI" Value="public:
 void DragMove();" />
<MemberSignature Language="F#" Value="member this.DragMove : unit -> unit" Usage="window.DragMove " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.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;netcore-3.0">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Allows a window to be dragged by a mouse with its left button down over an exposed area of the window's client area.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The left mouse button must be down when <xref:System.Windows.Window.DragMove%2A> is called. One way to detect when the left mouse button is pressed is to handle the <xref:System.Windows.UIElement.MouseLeftButtonDown> event.
When <xref:System.Windows.Window.DragMove%2A> is called, the left mouse button must be depressed over an exposed area of the window's client area.
> [!NOTE]
> This method cannot be called when a window is hosted in a browser.
## Examples
The following example shows how to override <xref:System.Windows.UIElement.OnMouseLeftButtonDown%2A> to call <xref:System.Windows.Window.DragMove%2A>.
[!code-csharp[WindowDragMoveSnippets#CallWindowDragMoveCODEBEHIND](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowDragMoveSnippets/CSharp/MainWindow.xaml.cs#callwindowdragmovecodebehind)]
[!code-vb[WindowDragMoveSnippets#CallWindowDragMoveCODEBEHIND](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WindowDragMoveSnippets/visualbasic/mainwindow.xaml.vb#callwindowdragmovecodebehind)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The left mouse button is not down.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for permission to drag a window. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.AllWindows" /></permission>
<altmember cref="E:System.Windows.Window.LocationChanged" />
</Docs>
</Member>
<Member MemberName="GetWindow">
<MemberSignature Language="C#" Value="public static System.Windows.Window GetWindow (System.Windows.DependencyObject dependencyObject);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Windows.Window GetWindow(class System.Windows.DependencyObject dependencyObject) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Window.GetWindow(System.Windows.DependencyObject)" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Windows::Window ^ GetWindow(System::Windows::DependencyObject ^ dependencyObject);" />
<MemberSignature Language="F#" Value="static member GetWindow : System.Windows.DependencyObject -> System.Windows.Window" Usage="System.Windows.Window.GetWindow dependencyObject" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Window</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dependencyObject" Type="System.Windows.DependencyObject" />
</Parameters>
<Docs>
<param name="dependencyObject">The dependency object.</param>
<summary>Returns a reference to the <see cref="T:System.Windows.Window" /> object that hosts the content tree within which the dependency object is located.</summary>
<returns>A <see cref="T:System.Windows.Window" /> reference to the host window.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="dependencyObject" /> is null.</exception>
</Docs>
</Member>
<Member MemberName="Hide">
<MemberSignature Language="C#" Value="public void Hide ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Hide() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Window.Hide" />
<MemberSignature Language="VB.NET" Value="Public Sub Hide ()" />
<MemberSignature Language="C++ CLI" Value="public:
 void Hide();" />
<MemberSignature Language="F#" Value="member this.Hide : unit -> unit" Usage="window.Hide " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Makes a window invisible.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A window is not closed when it is hidden, and neither the <xref:System.Windows.Window.Closing> nor <xref:System.Windows.Window.Closed> event is raised. Instead, the window's <xref:System.Windows.UIElement.Visibility%2A> property is set to <xref:System.Windows.Visibility.Hidden?displayProperty=nameWithType>.
If a window is the application's <xref:System.Windows.Application.MainWindow%2A> and the application's <xref:System.Windows.Application.ShutdownMode%2A> is <xref:System.Windows.ShutdownMode.OnMainWindowClose>, the application does not shut down. Likewise, the application does not shut down if a window is the only window and the application's shutdown mode is <xref:System.Windows.ShutdownMode.OnLastWindowClose>.
If you want to show and hide a window multiple times during the lifetime of an application, and you don't want to re-instantiate the window each time you show it, you can handle the <xref:System.Windows.Window.Closing> event, cancel it, and call the <xref:System.Windows.Window.Hide%2A> method. Then, you can call <xref:System.Windows.Window.Show%2A> on the same instance to re-open it.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">
<see cref="M:System.Windows.Window.Hide" /> is called on a window that is closing (<see cref="E:System.Windows.Window.Closing" />) or has been closed (<see cref="E:System.Windows.Window.Closed" />).</exception>
<altmember cref="M:System.Windows.Window.Show" />
<altmember cref="M:System.Windows.Window.ShowDialog" />
<altmember cref="M:System.Windows.Window.Close" />
</Docs>
</Member>
<Member MemberName="Icon">
<MemberSignature Language="C#" Value="public System.Windows.Media.ImageSource Icon { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Media.ImageSource Icon" />
<MemberSignature Language="DocId" Value="P:System.Windows.Window.Icon" />
<MemberSignature Language="VB.NET" Value="Public Property Icon As ImageSource" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Windows::Media::ImageSource ^ Icon { System::Windows::Media::ImageSource ^ get(); void set(System::Windows::Media::ImageSource ^ value); };" />
<MemberSignature Language="F#" Value="member this.Icon : System.Windows.Media.ImageSource with get, set" Usage="System.Windows.Window.Icon" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.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;netcore-3.0">
<AttributeName>set: System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Media.ImageSource</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a window's icon.</summary>
<value>An <see cref="T:System.Windows.Media.ImageSource" /> object that represents the icon.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Windows Presentation Foundation (WPF) standalone applications have two types of icons:
- One assembly icon, which is specified by using the `<ApplicationIcon>` property in the application's project build file. This icon is used as the desktop icon for an assembly.
> [!NOTE]
> When debugging in Visual Studio, your icon may not appear due to the hosting process. If you run the executable, the icon will appear. For more information, see [Hosting Process (vshost.exe)](https://msdn.microsoft.com/library/c6b9e2be-f18d-4d75-ac52-56d55784734b).
- One icon per window that is specified by setting <xref:System.Windows.Window.Icon%2A>. For each window, this icon is used in its title bar, its task bar button, and in its ALT-TAB application selection list entry.
A WPF window always displays an icon. When one is not provided by setting <xref:System.Windows.Window.Icon%2A>, WPF chooses an icon to display based on the following rules:
1. Use the assembly icon, if specified.
2. If the assembly icon is not specified, use the default Microsoft Windows icon.
If you use <xref:System.Windows.Window.Icon%2A> to specify a custom window icon, you can restore the default application icon by setting <xref:System.Windows.Window.Icon%2A> to `null`.
A single icon can be used in a variety of ways in Windows, including being shown in the title bar of a window, the task bar for a window, the ALT+TAB file selection list. Each of these shows the icon using a different size; a 16x16 pixel icon is displayed in the title bar of a window and in the task bar, while a 32x32 pixel icon is displayed in the ALT+TAB file selection list. Some applications, like [!INCLUDE[TLA#tla_winexpl](~/includes/tlasharptla-winexpl-md.md)], provide a **View** menu that allows you to choose the size of the icon you'd like to view.
To cater to the various display sizes, an icon file is composed of one or more actual icons where each one represents a version of the icon that targets a specific size and color depth. For example, one icon may only have a single 16x16 pixel icon with 16 colors, while another may contain 16x16 pixel and 32x32 pixel icons with both 16 colors and 256 colors.
If icons for all possible sizes and color depths exist within an icon file, <xref:System.Windows.Window> will use the appropriate icon. If an icon file contains only a subset of all the possible icons, <xref:System.Windows.Window> uses the next most appropriate icon in order of decreasing sizes and color depth.
The result is that an icon will always be used by <xref:System.Windows.Window>, although the icon used may not target the required size and color depth. For example, a 16x16 pixel icon with 16 colors may be used for display as a 32x32 pixel icon with 256 colors. This can cause undesirable visual effects, such as pixilation, but may be avoided by creating icons for all targeted sizes and color depths.
> [!NOTE]
> You cannot set or get this property when a window is hosted in a browser.
<a name="dependencyPropertyInfo_WindowIcon"></a>
## Dependency Property Information
|||
|-|-|
|Identifier field|<xref:System.Windows.Window.IconProperty>|
|Metadata properties set to `true`|None|
## Examples
The following example shows how to set a window icon.
[!code-xaml[WindowIconSnippets#WindowIconSetXAML](~/samples/snippets/xaml/VS_Snippets_Wpf/WindowIconSnippets/XAML/MainWindow.xaml#windowiconsetxaml)]
[!code-csharp[WindowIconSnippets#SetWindowIconInCode](~/samples/snippets/csharp/VS_Snippets_Wpf/WindowIconSnippets/CSharp/MainWindow.xaml.cs#setwindowiconincode)]
[!code-vb[WindowIconSnippets#SetWindowIconInCode](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WindowIconSnippets/visualbasic/mainwindow.xaml.vb#setwindowiconincode)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.UIPermission">for permission to set the icon. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.AllWindows" /></permission>
</Docs>
</Member>
<Member MemberName="IconProperty">
<MemberSignature Language="C#" Value="public static readonly System.Windows.DependencyProperty IconProperty;" />
<MemberSignature Language="ILAsm" Value=".field public static initonly class System.Windows.DependencyProperty IconProperty" />
<MemberSignature Language="DocId" Value="F:System.Windows.Window.IconProperty" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly IconProperty As DependencyProperty " />
<MemberSignature Language="C++ CLI" Value="public: static initonly System::Windows::DependencyProperty ^ IconProperty;" />
<MemberSignature Language="F#" Value=" staticval mutable IconProperty : System.Windows.DependencyProperty" Usage="System.Windows.Window.IconProperty" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.DependencyProperty</ReturnType>
</ReturnValue>
<Docs>
<summary>Identifies the <see cref="P:System.Windows.Window.Icon" /> dependency property.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="IsActive">
<MemberSignature Language="C#" Value="public bool IsActive { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsActive" />
<MemberSignature Language="DocId" Value="P:System.Windows.Window.IsActive" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property IsActive As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool IsActive { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsActive : bool" Usage="System.Windows.Window.IsActive" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that indicates whether the window is active.</summary>
<value>
<see langword="true" /> if the window is active; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An active window is the user's current foreground window and has the focus, which is signified by the active appearance of the title bar. An active window will also be the top-most of all top-level windows that don't explicitly set the <xref:System.Windows.Window.Topmost%2A> property.
<a name="dependencyPropertyInfo_WindowIsActive"></a>
## Dependency Property Information
|||
|-|-|
|Identifier field|<xref:System.Windows.Window.IsActiveProperty>|
|Metadata properties set to `true`|None|
]]></format>
</remarks>
<altmember cref="M:System.Windows.Window.Activate" />
<altmember cref="E:System.Windows.Window.Activated" />
<altmember cref="E:System.Windows.Window.Deactivated" />
</Docs>
</Member>
<Member MemberName="IsActiveProperty">
<MemberSignature Language="C#" Value="public static readonly System.Windows.DependencyProperty IsActiveProperty;" />
<MemberSignature Language="ILAsm" Value=".field public static initonly class System.Windows.DependencyProperty IsActiveProperty" />
<MemberSignature Language="DocId" Value="F:System.Windows.Window.IsActiveProperty" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly IsActiveProperty As DependencyProperty " />
<MemberSignature Language="C++ CLI" Value="public: static initonly System::Windows::DependencyProperty ^ IsActiveProperty;" />
<MemberSignature Language="F#" Value=" staticval mutable IsActiveProperty : System.Windows.DependencyProperty" Usage="System.Windows.Window.IsActiveProperty" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.DependencyProperty</ReturnType>
</ReturnValue>
<Docs>
<summary>Identifies the <see cref="P:System.Windows.Window.IsActive" /> dependency property.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Left">
<MemberSignature Language="C#" Value="public double Left { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance float64 Left" />
<MemberSignature Language="DocId" Value="P:System.Windows.Window.Left" />
<MemberSignature Language="VB.NET" Value="Public Property Left As Double" />
<MemberSignature Language="C++ CLI" Value="public:
 property double Left { double get(); void set(double value); };" />
<MemberSignature Language="F#" Value="member this.Left : double with get, set" Usage="System.Windows.Window.Left" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<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;netcore-3.0">
<AttributeName>System.ComponentModel.TypeConverter("System.Windows.LengthConverter, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5">
<AttributeName>System.ComponentModel.TypeConverter("System.Windows.LengthConverter, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Double</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the position of the window's left edge, in relation to the desktop.</summary>
<value>The position of the window's left edge, in logical units (1/96th of an inch).</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When the <xref:System.Windows.Window> is maximized or minimized, this value represents the left edge of the restore point for the <xref:System.Windows.Window>.