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
Preface

Along with Windows 1.0, in the year 1985, Microsoft introduced Graphics Device Interface (GDI) and the USER subsystem in order to build a Windows-based Graphical User Interface (GUI). In 1990, OpenGL came into picture to create 2D and 3D graphics on Windows and non-Windows systems. In 1995, Microsoft presented another technology, called DirectX, to create high-performance 2D/3D graphics. Later, GDI+ was introduced to add alpha blending and gradient brush support on top of the existing GDI.

In 2002, Microsoft introduced .NET Framework. Along with this, Windows Forms was also introduced to build User Interface (UI) for Windows using C# and Visual Basic languages. It was built on top of GDI+, and hence, it still had the limitations of the GDI+ and USER subsystems.

Over the years, Microsoft decided to bring a new technology to build rich UIs for Windows-based applications, which not only helped the users (developers and designers) to escape the limitations of GDI/GDI+ and USER subsystems, but also helped them to improve their productivity when building desktop-based applications.

In November 2006, along with .NET 3.0, Windows Presentation Foundation (WPF) was introduced to provide the developers a unified programming model to build dynamic, data-driven desktop applications for Windows. It came with a broad set of features to create a graphical subsystem to render rich UIs using various controls, layouts, graphics, resources, and more, considering the application and the security of the data. As it was first shipped as part of the .NET Framework 3.0, the first release was called WPF 3.0.

WPF is a resolution-independent framework that uses a vector-based rendering engine using an XML-based language called XAML (pronounced Zammel), to create modern user experiences that provided a declarative model for application programming. Using this, you can easily customize the controls and add skins to it to get a better representation of the application's UI.

As WPF was different than classic Windows Forms, as it uses XAML, data binding, templates, styles, animations, documents, and more, initially it got little attention. However, later, it started gaining a lot of popularity and attraction. Many updated versions were released to add more functionality to it to make it robust and powerful.

In this book, we will cover a set of recipes that will show you how to perform common tasks using WPF. Starting with WPF fundamentals, we will cover standard controls, layouts, panels, data bindings, custom controls, user controls, styles, templates, triggers, and animations and later move on to the uses of resources, MVVM patterns, WCF services, debugging, threading, and WPF interoperabilities, to make sure you understand the foundation properly.

The examples given in this book are simple, easy to understand, and provide you with a what you need to learn and master the skills that you need to build desktop applications using WPF. By the time you reach the end of this book, you will be proficient enough with deep knowledge about each of the chapters that it covers. Although this book has covered most of the important topics, there will always be some topics that no books can completely cover. You will definitely enjoy reading this book, as there are lots of graphical and textual steps to help you gain confidence working with Windows Presentation Foundation.