Skip to content

Commit 8476ff4

Browse files
authored
Add info about returning false from dialog window (dotnet#9769)
* Add info about returning false from dialog window * simplify wording
1 parent 8f1416b commit 8476ff4

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

xml/System.Windows/Window.xml

+23-26
Original file line numberDiff line numberDiff line change
@@ -395,54 +395,51 @@
395395
<format type="text/markdown"><![CDATA[
396396
397397
## Remarks
398-
A <xref:System.Windows.Window> can be closed using one of several, well-known, system-provided mechanisms located in its title bar, including:
399398
400-
- ALT+F4.
399+
A <xref:System.Windows.Window> can be closed using one of several, well-known, system-provided mechanisms located in its title bar, including:
401400
402-
- System menu &#124; **Close**.
401+
- ALT+F4.
402+
- System menu &#124; **Close**.
403+
- **Close** button.
403404
404-
- **Close** button.
405+
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:
405406
406-
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:
407-
408-
- **File** &#124; **Exit** on a main window.
409-
410-
- **File** &#124; **Close** or a **Close** button on a child window.
407+
- **File** > **Exit** on a main window.
408+
- **File** > **Close** or a **Close** button on a child window.
411409
412410
> [!NOTE]
413-
> **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>.
411+
> **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>.
414412
415-
These mechanisms require you to explicitly call <xref:System.Windows.Window.Close%2A> to close a window.
413+
These mechanisms require you to explicitly call <xref:System.Windows.Window.Close%2A> to close a window.
416414
417415
> [!NOTE]
418-
> 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>.
416+
> 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>.
419417
420-
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:
418+
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:
421419
422-
- The <xref:System.Windows.Window> is removed from <xref:System.Windows.Application.Windows%2A?displayProperty=nameWithType> (if an <xref:System.Windows.Application> object exists).
420+
- The <xref:System.Windows.Window> is removed from <xref:System.Windows.Application.Windows%2A?displayProperty=nameWithType> (if an <xref:System.Windows.Application> object exists).
423421
424-
- 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.
422+
- 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.
425423
426-
- The <xref:System.Windows.Window.Closed> event is raised.
424+
- The <xref:System.Windows.Window.Closed> event is raised.
427425
428-
- Unmanaged resources created by the <xref:System.Windows.Window> are disposed.
426+
- Unmanaged resources created by the <xref:System.Windows.Window> are disposed.
429427
430-
- If <xref:System.Windows.Window.ShowDialog%2A> was called to show the <xref:System.Windows.Window>, <xref:System.Windows.Window.ShowDialog%2A> returns.
428+
- If <xref:System.Windows.Window.ShowDialog%2A> was called to show the <xref:System.Windows.Window>, <xref:System.Windows.Window.ShowDialog%2A> returns false.
431429
432-
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.
430+
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.
433431
434432
> [!NOTE]
435-
> This method cannot be called when a window is hosted in a browser.
436-
437-
433+
> This method cannot be called when a window is hosted in a browser.
438434
439435
## Examples
440-
The following example shows a **File** &#124; **Exit** menu being handled to explicitly call <xref:System.Windows.Window.Close%2A>.
441436
442-
:::code language="xaml" source="~/snippets/csharp/System.Windows/Window/Close/MainWindow.xaml" id="Snippetwindowclosexaml":::
437+
The following example shows a **File** > **Exit** menu being handled to explicitly call <xref:System.Windows.Window.Close%2A>.
438+
439+
:::code language="xaml" source="~/snippets/csharp/System.Windows/Window/Close/MainWindow.xaml" id="Snippetwindowclosexaml":::
443440
444-
:::code language="csharp" source="~/snippets/csharp/System.Windows/Window/Close/MainWindow.xaml.cs" id="Snippetwindowclosecodebehind":::
445-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/WindowCloseSnippets/visualbasic/mainwindow.xaml.vb" id="Snippetwindowclosecodebehind":::
441+
:::code language="csharp" source="~/snippets/csharp/System.Windows/Window/Close/MainWindow.xaml.cs" id="Snippetwindowclosecodebehind":::
442+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/WindowCloseSnippets/visualbasic/mainwindow.xaml.vb" id="Snippetwindowclosecodebehind":::
446443
447444
]]></format>
448445
</remarks>

0 commit comments

Comments
 (0)