Free Sample
+ Collection

Windows Presentation Foundation 4.5 Cookbook

Pavel Yosifovich

For C# developers, this book offers a fast route to getting more closely acquainted with the ins and outs of Windows Presentation Foundation. The recipe approach smoothes out the complexities and enhances learning.
RRP $35.99
RRP $59.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849686228
Paperback464 pages

About This Book

  • Full of illustrations, diagrams, and tips with clear step-by-step instructions and real world examples
  • Gain a strong foundation of WPF features and patterns
  • Leverage the MVVM pattern to build decoupled, maintainable apps

Who This Book Is For

If you are C# developer looking forward to increasing your understanding and knowledge of WPF, then this is the best guide for you. Basic experience with Visual Studio 2010 is mandatory, as well as good C# skills. Previous experience with Windows Forms is not required.

Table of Contents

Chapter 1: Foundations
Creating custom type instances in XAML
Creating a dependency property
Using an attached property
Creating an attached property
Accessing a static property from XAML
Creating a custom markup extension
Handling routed events
Chapter 2: Resources
Using logical resources
Dynamically binding to a logical resource
Using user-selected colors and fonts
Using binary resources
Accessing binary resources in code
Accessing binary resources from another assembly
Managing logical resources
Chapter 3: Layout and Panels
Creating a table-like user interface
Dynamically sizing grid rows/columns
Creating a scrollable user interface
Creating a border around panels and elements
Placing elements in exact positions
Adding/removing elements to a panel dynamically
Creating a tabbed user interface
Implementing drag-and-drop
Chapter 4: Using Standard Controls
Working with text
Using content controls
Displaying images
Creating tooltips
Creating a list of items
Creating a standard menu
Creating a context menu
Selecting options with checkboxes and radio buttons
Manipulating tab order and focus
Chapter 5: Application and Windows
Creating a window
Creating a dialog box
Using the common dialog boxes
Creating ownership between windows
Creating a custom shaped window
Creating a single instance application
Handling an unhandled exception
Chapter 6: Data Binding
Element to element binding
Binding to a single object
Binding to a collection
Using data templates
Using value converters
Creating a master-detail view
Sorting and filtering bound collections
Grouping bound collections
Binding to multiple properties
Binding hierarchical data to a TreeView
Presenting data in a grid
Validating data
Chapter 7: Commands and MVVM
Using routed commands
Implementing a basic MVVM application
Building a simple MVVM framework
Building a complete MVVM style application
Creating an undo/redo system
Chapter 8: Styles, Triggers, and Control Templates
Creating and using styles
Applying a style automatically
Creating a property trigger
Using data triggers
Creating an event trigger
Creating a multi trigger
Using behaviors
Replacing the control template of a progress bar
Replacing the control template of a scroll bar
Customizing selection in a Selector control
Chapter 9: Graphics and Animation
Creating a custom shape
Applying transforms on elements
Manipulating a bitmap programmatically
Creating adorners
Creating property-based animations
Creating path-based animations
Creating custom animations
Adding animation easing to animations
Using custom effects with pixel shaders
Chapter 10: Custom Elements
Creating a user control
Handling standard commands in a user control
Creating a custom (templated) control
Customizing a default template of custom control
Creating a custom panel
Creating a lightweight custom element
Chapter 11: Threading
Updating the UI from a non-UI thread
Adding cancelation support
Using the BackgroundWorker component
Adding cancellation and progress with BackgroundWorker
Using a timer to do periodic updates
Using C# 5.0 to perform asynchronous operations

What You Will Learn

  • Get tips and insights to maximize your productivity
  • Learn to build complex and flexible user interfaces using XAML
  • Perform lengthy operations asynchronously while keeping the UI responsive
  • Get well-versed with WPF features such as data binding, layout, resources, templates, and styles
  • Customize a control’s template to alter appearance but preserve behaviour

In Detail

Windows Presentation Foundation (WPF) provides developers with a unified programming model for building rich Windows smart client user experiences that incorporate UI, media, and documents.

WPF has become the leading technology for developing rich client applications on the Windows platform, packed with features and capabilities. However, WPF is big; in fact, it’s huge, causing a steep learning curve for the beginner and even for those already using some WPF features.

Windows Presentation Foundation 4.5 Cookbook provides clear recipes for common WPF tasks. It includes detailed explanations and code examples for customizing and enhancing the basic scenarios, while gaining a deep understanding of WPF mechanics and capabilities.

WPF is different and requires a different mind-set and approach. This book provides recipes and insights not only in its design but also its practical implementation details.

Starting from the foundations of WPF, such as dependency properties and XAML, the book touches on all major WPF aspects, such as controls and layout, resources, and digs deep into its unprecedented data binding capabilities.

The book shows data and control templates in action, which allow full customizations of displayed data and controls in a declarative way. Supported by styles and resources makes data binding all the more powerful. The Model View View-Model pattern is presented as an effective way of maximizing decoupling of components, while providing an elegant way of expanding applications while maintaining a tight grip on complexity.

The later parts discuss custom elements and controls – the ultimate customization mechanism, and looks at multithreading issues, and how .NET 4.5 task parallelism features can enhance application performance.


Read More

Recommended for You

WCF 4.0 Multi-tier Services Development with LINQ to Entities
$ 29.99
Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications
$ 29.99
Programming Windows Workflow Foundation: Practical WF Techniques and Examples using XAML and C#
$ 13.50