fixed creeping lint errors (#1302)

This commit is contained in:
Andy (Steve) De George
2022-02-07 14:55:46 -06:00
committed by GitHub
parent c2384a837e
commit 172e68963a
4 changed files with 12 additions and 12 deletions
@@ -20,7 +20,7 @@ Add a new form with Visual Studio.
:::image type="content" source="media/how-to-add/right-click.png" alt-text="Right click solution explorer to add new form to windows forms project"::: :::image type="content" source="media/how-to-add/right-click.png" alt-text="Right click solution explorer to add new form to windows forms project":::
01. In the **Name** box, type a name for your form, such as *MyNewForm*. Visual Studio will provide a default and unique name that you may use. 01. In the **Name** box, type a name for your form, such as _MyNewForm_. Visual Studio will provide a default and unique name that you may use.
:::image type="content" source="media/how-to-add/new-form-dialog.png" alt-text="Add item dialog in visual studio for windows forms"::: :::image type="content" source="media/how-to-add/new-form-dialog.png" alt-text="Add item dialog in visual studio for windows forms":::
@@ -303,7 +303,7 @@ If your app has an _App.config_ file, remove the `<supportedRuntime>` element:
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
``` ```
There are some things you should consider with the *App.config* file. The *App.config* file in .NET Framework was used not only to configure the app, but to configure runtime settings and behavior, such as logging. The *App.config* file in .NET 5+ (and .NET Core) is no longer used for runtime configuration. If your *App.config* file has these sections, they won't be respected. There are some things you should consider with the _App.config_ file. The _App.config_ file in .NET Framework was used not only to configure the app, but to configure runtime settings and behavior, such as logging. The _App.config_ file in .NET 5+ (and .NET Core) is no longer used for runtime configuration. If your _App.config_ file has these sections, they won't be respected.
## Add the compatibility package ## Add the compatibility package
@@ -23,13 +23,13 @@ These types of windows are known as _dialog boxes_. A dialog box can be displaye
Displaying a _modal_ dialog box to the user is a technique with which the application interrupts what it was doing until the user closes the dialog box. This generally comes in the form of a prompt or alert. Other windows in the application can't be interacted with until the dialog box is closed. Once the _modal_ dialog box is closed, the application continues. The most common dialog boxes are used to show an open file or save file prompt, displaying the printer dialog, or messaging the user with some status. Displaying a _modal_ dialog box to the user is a technique with which the application interrupts what it was doing until the user closes the dialog box. This generally comes in the form of a prompt or alert. Other windows in the application can't be interacted with until the dialog box is closed. Once the _modal_ dialog box is closed, the application continues. The most common dialog boxes are used to show an open file or save file prompt, displaying the printer dialog, or messaging the user with some status.
A *modeless* dialog box doesn't prevent a user from activating other windows while it's open. For example, if a user wants to find occurrences of a particular word in a document, a main window will often open a dialog box to ask a user what word they're looking for. Since the application doesn't want to prevent the user from editing the document, the dialog box doesn't need to be modal. A modeless dialog box at least provides a **Close** button to close the dialog box. Other buttons may be provided to run specific functions, such as a **Find Next** button to find the next word in a word search. A _modeless_ dialog box doesn't prevent a user from activating other windows while it's open. For example, if a user wants to find occurrences of a particular word in a document, a main window will often open a dialog box to ask a user what word they're looking for. Since the application doesn't want to prevent the user from editing the document, the dialog box doesn't need to be modal. A modeless dialog box at least provides a **Close** button to close the dialog box. Other buttons may be provided to run specific functions, such as a **Find Next** button to find the next word in a word search.
With WPF you can create several types of dialog boxes, such as message boxes, common dialog boxes, and custom dialog boxes. This article discusses each, and the [Dialog Box Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Windows/DialogBox) provides matching examples. With WPF you can create several types of dialog boxes, such as message boxes, common dialog boxes, and custom dialog boxes. This article discusses each, and the [Dialog Box Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Windows/DialogBox) provides matching examples.
## Message boxes ## Message boxes
A *message box* is a dialog box that can be used to display textual information and to allow users to make decisions with buttons. The following figure shows a message box that asks a question and provides the user with three buttons to answer the question. A _message box_ is a dialog box that can be used to display textual information and to allow users to make decisions with buttons. The following figure shows a message box that asks a question and provides the user with three buttons to answer the question.
:::image type="content" source="media/dialog-boxes-overview/word-processor-dialog.png" alt-text="Word processor dialog box asking if you want to save the changes to the document before the application closes."::: :::image type="content" source="media/dialog-boxes-overview/word-processor-dialog.png" alt-text="Word processor dialog box asking if you want to save the changes to the document before the application closes.":::
@@ -41,7 +41,7 @@ For more information, see [How to open a message box](how-to-open-message-box.md
Windows implements different kinds of reusable dialog boxes that are common to all applications, including dialog boxes for selecting files and printing. Windows implements different kinds of reusable dialog boxes that are common to all applications, including dialog boxes for selecting files and printing.
Since these dialog boxes are provided by the operating system, they're shared among all the applications that run on the operating system. These dialog boxes provide a consistent user experience, and are known as *common dialog boxes*. As a user uses a common dialog box in one application, they don't need to learn how to use that dialog box in other applications. Since these dialog boxes are provided by the operating system, they're shared among all the applications that run on the operating system. These dialog boxes provide a consistent user experience, and are known as _common dialog boxes_. As a user uses a common dialog box in one application, they don't need to learn how to use that dialog box in other applications.
WPF encapsulates the open file, save file, and print common dialog boxes and exposes them as managed classes for you to use in standalone applications. WPF encapsulates the open file, save file, and print common dialog boxes and exposes them as managed classes for you to use in standalone applications.
@@ -55,7 +55,7 @@ The following figure illustrates the constituent parts of a window:
A window is divided into two areas: the non-client area and client area. A window is divided into two areas: the non-client area and client area.
The *non-client area* of a window is implemented by WPF and includes the parts of a window that are common to most windows, including the following: The _non-client area_ of a window is implemented by WPF and includes the parts of a window that are common to most windows, including the following:
- A title bar (1-5). - A title bar (1-5).
- An icon (1). - An icon (1).
@@ -64,14 +64,14 @@ The *non-client area* of a window is implemented by WPF and includes the parts o
- System menu (6) with menu items. Appears when clicking on the icon (1). - System menu (6) with menu items. Appears when clicking on the icon (1).
- Border (7). - Border (7).
The *client area* of a window is the area within a window's non-client area and is used by developers to add application-specific content, such as menu bars, tool bars, and controls. The _client area_ of a window is the area within a window's non-client area and is used by developers to add application-specific content, such as menu bars, tool bars, and controls.
- Client area (8). - Client area (8).
- Resize grip (9). This is a control added to the Client area (8). - Resize grip (9). This is a control added to the Client area (8).
## Implementing a window ## Implementing a window
The implementation of a typical window includes both appearance and behavior, where *appearance* defines how a window looks to users and *behavior* defines the way a window functions as users interact with it. In WPF, you can implement the appearance and behavior of a window using either code or XAML markup. The implementation of a typical window includes both appearance and behavior, where _appearance_ defines how a window looks to users and _behavior_ defines the way a window functions as users interact with it. In WPF, you can implement the appearance and behavior of a window using either code or XAML markup.
In general, however, the appearance of a window is implemented using XAML markup, and its behavior is implemented using code-behind, as shown in the following example. In general, however, the appearance of a window is implemented using XAML markup, and its behavior is implemented using code-behind, as shown in the following example.
@@ -233,7 +233,7 @@ A window that is opened by using the <xref:System.Windows.Window.Show%2A> method
- Cover the other (unless one of the windows has its <xref:System.Windows.Window.Topmost%2A> property set to `true`). - Cover the other (unless one of the windows has its <xref:System.Windows.Window.Topmost%2A> property set to `true`).
- Be minimized, maximized, and restored without affecting the other. - Be minimized, maximized, and restored without affecting the other.
Some windows require a relationship with the window that opens them. For example, an Integrated Development Environment (IDE) application may open property windows and tool windows whose typical behavior is to cover the window that creates them. Furthermore, such windows should always close, minimize, maximize, and restore in concert with the window that created them. Such a relationship can be established by making one window *own* another, and is achieved by setting the <xref:System.Windows.Window.Owner%2A> property of the *owned window* with a reference to the *owner window*. This is shown in the following example. Some windows require a relationship with the window that opens them. For example, an Integrated Development Environment (IDE) application may open property windows and tool windows whose typical behavior is to cover the window that creates them. Furthermore, such windows should always close, minimize, maximize, and restore in concert with the window that created them. Such a relationship can be established by making one window _own_ another, and is achieved by setting the <xref:System.Windows.Window.Owner%2A> property of the _owned window_ with a reference to the _owner window_. This is shown in the following example.
:::code language="csharp" source="snippets/index/csharp/ChildWindow1.xaml.cs" range="12-18"::: :::code language="csharp" source="snippets/index/csharp/ChildWindow1.xaml.cs" range="12-18":::
:::code language="vb" source="snippets/index/vb/ChildWindow1.xaml.vb" range="2-7"::: :::code language="vb" source="snippets/index/vb/ChildWindow1.xaml.vb" range="2-7":::
@@ -364,7 +364,7 @@ If the startup location is specified as <xref:System.Windows.WindowStartupLocati
### Topmost windows and z-order ### Topmost windows and z-order
Besides having an x and y location, a window also has a location in the z dimension, which determines its vertical position with respect to other windows. This is known as the window's z-order, and there are two types: **normal** z-order and **topmost** z-order. The location of a window in the *normal z-order* is determined by whether it's currently active or not. By default, a window is located in the normal z-order. The location of a window in the *topmost z-order* is also determined by whether it's currently active or not. Furthermore, windows in the topmost z-order are always located above windows in the normal z-order. A window is located in the topmost z-order by setting its <xref:System.Windows.Window.Topmost%2A> property to `true`. Besides having an x and y location, a window also has a location in the z dimension, which determines its vertical position with respect to other windows. This is known as the window's z-order, and there are two types: **normal** z-order and **topmost** z-order. The location of a window in the _normal z-order_ is determined by whether it's currently active or not. By default, a window is located in the normal z-order. The location of a window in the _topmost z-order_ is also determined by whether it's currently active or not. Furthermore, windows in the topmost z-order are always located above windows in the normal z-order. A window is located in the topmost z-order by setting its <xref:System.Windows.Window.Topmost%2A> property to `true`.
Within each z-order type, the currently active window appears above all other windows in the same z-order. Within each z-order type, the currently active window appears above all other windows in the same z-order.
@@ -466,9 +466,9 @@ The order of precedence can also determine the size of a window when it's maximi
During the lifetime of a resizable window, it can have three states: normal, minimized, and maximized. A window with a _normal_ state is the default state of a window. A window with this state allows a user to move and resize it by using a resize grip or the border, if it's resizable. During the lifetime of a resizable window, it can have three states: normal, minimized, and maximized. A window with a _normal_ state is the default state of a window. A window with this state allows a user to move and resize it by using a resize grip or the border, if it's resizable.
A window with a *minimized* state collapses to its task bar button if <xref:System.Windows.Window.ShowInTaskbar%2A> is set to `true`; otherwise, it collapses to the smallest possible size it can be and moves itself to the bottom-left corner of the desktop. Neither type of minimized window can be resized using a border or resize grip, although a minimized window that isn't shown in the task bar can be dragged around the desktop. A window with a _minimized_ state collapses to its task bar button if <xref:System.Windows.Window.ShowInTaskbar%2A> is set to `true`; otherwise, it collapses to the smallest possible size it can be and moves itself to the bottom-left corner of the desktop. Neither type of minimized window can be resized using a border or resize grip, although a minimized window that isn't shown in the task bar can be dragged around the desktop.
A window with a *maximized* state expands to the maximum size it can be, which will only be as large as its <xref:System.Windows.FrameworkElement.MaxWidth%2A>, <xref:System.Windows.FrameworkElement.MaxHeight%2A>, and <xref:System.Windows.Window.SizeToContent%2A> properties dictate. Like a minimized window, a maximized window can't be resized by using a resize grip or by dragging the border. A window with a _maximized_ state expands to the maximum size it can be, which will only be as large as its <xref:System.Windows.FrameworkElement.MaxWidth%2A>, <xref:System.Windows.FrameworkElement.MaxHeight%2A>, and <xref:System.Windows.Window.SizeToContent%2A> properties dictate. Like a minimized window, a maximized window can't be resized by using a resize grip or by dragging the border.
> [!NOTE] > [!NOTE]
> The values of the <xref:System.Windows.Window.Top%2A>, <xref:System.Windows.Window.Left%2A>, <xref:System.Windows.FrameworkElement.Width%2A>, and <xref:System.Windows.FrameworkElement.Height%2A> properties of a window always represent the values for the normal state, even when the window is currently maximized or minimized. > The values of the <xref:System.Windows.Window.Top%2A>, <xref:System.Windows.Window.Left%2A>, <xref:System.Windows.FrameworkElement.Width%2A>, and <xref:System.Windows.FrameworkElement.Height%2A> properties of a window always represent the values for the normal state, even when the window is currently maximized or minimized.