Contents tagged with WPF

  • Windows Presentation Foundation 4.5 Cookbook Review

    As promised, here’s my review of Windows Presentation Foundation 4.5 Cookbook, that Packt Publishing kindly made available to me.

    It is an introductory book, targeted at WPF newcomers or users with few experience, following the typical recipes or cookbook style. Like all Packt Publishing books on development, each recipe comes with sample code that is self-sufficient for understanding the concepts it tries to illustrate.

    It starts on chapter 1 by introducing the most important concepts, the XAML language itself, what can be declared in XAML and how to do it, what are dependency and attached properties as well as markup extensions and events, which should give readers a most required introduction to how WPF works and how to do basic stuff.

    It moves on to resources on chapter 2, which also makes since, since it’s such an important concept in WPF.

    Next, chapter 3, come the panels used for laying controls on the screen, all of the out of the box panels are described with typical use cases.

    Controls come next in chapter 4; the difference between elements and controls is introduced, as well as content controls, headered controls and items controls, and all standard controls are introduced. The book shows how to change the way they look by using templates.

    The next chapter, 5, talks about top level windows and the WPF application object: how to access startup arguments, how to set the main window, using standard dialogs and there’s even a sample on how to have a irregularly-shaped window.

    This is one of the most important concepts in WPF: data binding, which is the theme for the following chapter, 6. All common scenarios are introduced, the binding modes, directions, triggers, etc. It talks about the INotifyPropertyChanged interface and how to use it for notifying data binding subscribers of changes in data sources. Data templates and selectors are also covered, as are value converters and data triggers. Examples include master-detail and sorting, grouping and filtering collections and binding trees and grids. Last it covers validation rules and error templates.

    Chapter 7 talks about the current trend in WPF development, the Model View View-Model (MVVM) framework. This is a well known pattern for connecting things interface to actions, and it is explained competently. A typical implementation is presented which also presents the command pattern used throughout WPF. A complete application using MVVM is presented from start to finish, including typical features such as undo.

    Style and layout is covered on chapter 8. Why/how to use styles, applying them automatically,  using the many types of triggers to change styles automatically, using Expression Blend behaviors and templates are all covered.

    Next chapter, 9, is about graphics and animations programming. It explains how to create shapes, transform common UI elements, apply special effects and perform simple animations.

    The following chapter, 10, is about creating custom controls, either by deriving from UserControl or from an existing control or framework element class, applying custom templates for changing the way the control looks. One useful example is a custom layout panel that arranges its children along a circumference.

    The final chapter, 11, is about multi-threading programming and how one can integrate it with WPF. Includes how to invoke methods and properties on WPF classes from threads other than the main UI, using background tasks and timers and even using the new C# 5.0 asynchronous operations.

    It’s an interesting book, like I said, mostly for newcomers. It provides a competent introduction to WPF, with examples that cover the most common scenarios and also give directions to more complex ones. I recommend it to everyone wishing to learn WPF.


  • Win a Free Copy of Windows Presentation Foundation 4.5 Cookbook

    Win A free copy of the 'Windows Presentation Foundation 4.5 Cookbook', just by commenting!

    For the contest, Packt Publishing has two eBook copies of Windows Presentation Foundation 4.5 Cookbookto be given away to two lucky winners.

    How you can win:

    To win your copy of this book, all you need to do is come up with a comment below highlighting the reason "why you would like to win this book”.

    Duration of the contest & selection of winners:

    The contest is valid for 14 days (until December 3), and is open to everyone. Winners will be selected on the basis of their comment posted.


    Windows Presentation Foundation 4.5 Cookbookis written by Pavel Yosifovich, the CTO of CodeValue (, a software development, consulting, and training company, based in Israel.

    This book is written in an easy-to-read style, with a strong emphasis on real-world, practical examples. Step-by-step explanations are provided for performing important tasks. This book is the best guide for C# developer who is looking forward to increase understanding and knowledge of WPF.

    Using this book, readers will 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 and also customize a control’s template to alter appearance but preserve behavior.

    In the next days I will post my review on this book. In the meantime, here’s the table of contents:

    Chapter 1: Foundations
    Chapter 2: Resources
    Chapter 3: Layout and Panels
    Chapter 4: Using Standard Controls
    Chapter 5: Application and Windows
    Chapter 6: Data Binding
    Chapter 7: Commands and MVVM
    Chapter 8: Styles, Triggers, and Control Templates
    Chapter 9: Graphics and Animation
    Chapter 10: Custom Elements
    Chapter 11: Threading

    I’m waiting for your comments! Winking smile