Chapter 10. Windows and Dialogs

The Window class, mentioned in Chapter 2, is the required class for the application's main window. To fit in with the rest of the Windows applications, the WPF Window class is flexible. It supports building top-level style main windows and dialogs, which we'll discuss in this chapter, as well as serving as the base class for the NavigationWindow, which we'll discuss in the next chapter.

Window

In Chapter 2, we looked at the lifetime and services of an application, often as related to the windows that constitute the UI of the application. However, we didn't talk much about the windows themselves. The Window class derives from the ContentControl (described in Chapter 5) and adds the chrome around the edges that contains the title; the minimize, maximize, and close buttons; and so on. The content can look however you want. The chrome itself has more limited options.

Window Look and Feel

The look and feel of the frame of a window is largely determined by the Icon, Title, and WindowStyle properties, the latter of which has four options (None, SingleBorderWindow, ThreeDBorderWindow, and ToolWindow), shown in Figure 10-1 (the default is SingleBorderWindow).

Window styles in Windows Vista and Windows XP

Figure 10-1. Window styles in Windows Vista and Windows XP

You'll notice that the icon and/or title are shown or not depending on the window style. You'll also notice that the None WindowStyle still contains ...

Get Programming WPF, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.