Book Image

Windows Presentation Foundation Development Cookbook

Book Image

Windows Presentation Foundation Development Cookbook

Overview of this book

Windows Presentation Foundation (WPF) is Microsoft's development tool for building rich Windows client user experiences that incorporate UIs, media, and documents. With the updates in .NET 4.7, Visual Studio 2017, C# 7, and .NET Standard 2.0, WPF has taken giant strides and is now easier than ever for developers to use. If you want to get an in-depth view of WPF mechanics and capabilities, then this book is for you. The book begins by teaching you about the fundamentals of WPF and then quickly shows you the standard controls and the layout options. It teaches you about data bindings and how to utilize resources and the MVVM pattern to maintain a clean and reusable structure in your code. After this, you will explore the animation capabilities of WPF and see how they integrate with other mechanisms. Towards the end of the book, you will learn about WCF services and explore WPF's support for debugging and asynchronous operations. By the end of the book, you will have a deep understanding of WPF and will know how to build resilient applications.
Table of Contents (13 chapters)
2
Using WPF Standard Controls

There's more...

The Window class provides you with a bunch of properties, methods, and events to customize the look of the window, and perform specific operations or to be notified of the current context. To ask the client area to support transparency, set the AllowsTransparency property of the window to true. This is often useful when you want to create a custom-shaped window or a skinned theme.

You can change the default icon of the window by setting the Icon property and enable/disable the window resizing by setting the ResizeMode property. You can also set the window title, startup location, window state, window style, and taskbar visibility by settings the Title, WindowStartupLocation, WindowState, WindowStyle, and ShowInTaskbar properties, respectively.

Not only these but you can bring the window to the foreground by calling its Activate() method and close the window by calling the Close() method available in the Window class. Sometimes, when you want to hide the window instead of quitting it completely, you can utilize the Hide() method to make the window hidden and bring it back again by calling the Show() method on the same instance.

The class also exposes some events to notify you of the current contextual information. You can use the Activated, Deactivated, Closing, Closed, and StateChanged, events in your code to get such notifications.