Book Image

Mastering Windows Presentation Foundation

By : Sheridan Yuen
Book Image

Mastering Windows Presentation Foundation

By: Sheridan Yuen

Overview of this book

Windows Presentation Foundation is rich in possibilities when it comes to delivering an excellent user experience. This book will show you how to build professional-grade applications that look great and work smoothly. We start by providing you with a foundation of knowledge to improve your workflow – this includes teaching you how to build the base layer of the application, which will support all that comes after it. We’ll also cover the useful details of data binding. Next, we cover the user interface and show you how to get the most out of the built-in and custom WPF controls. The final section of the book demonstrates ways to polish your applications, from adding practical animations and data validation to improving application performance. The book ends with a tutorial on how to deploy your applications and outlines potential ways to apply your new-found knowledge so you can put it to use right away.
Table of Contents (19 chapters)
Mastering Windows Presentation Foundation
About the Author
About the Reviewer
Customer Feedback

Creating custom controls

When using WPF, we can generally create the UI that we want using the many techniques already discussed in this book. However, in the cases when we require a totally unique control with both a custom drawn appearance and custom functionality, then we may need to declare a custom control.

Developing custom controls is very different to creating UserControl elements and it can take some time to master this. To start with, we will need to add a new project of type WPF Custom Control Library to declare them in. Also, instead of having a XAML page and a code behind file, we only have the code file. At this point, you may be wondering where we define what our control should look like.

In fact, when defining a custom control, we declare our XAML in a separate file named Generic.xaml, which is added by Visual Studio when we add our controls project. To clarify, the XAML for all of the custom controls that we declare in this project will go into this file. This does not relate...