Mastering Windows Presentation Foundation

Book description

Master the art of building modern desktop applications on Windows

About This Book

  • Learn how to use the MVVM software architectural pattern and see the benefits of using it with Windows Presentation Fountain (WPF)

  • Explore various ways to enhance efficiency through performance tuning and UI automation

  • Obtain a deep understanding of data validation and understand various methods that suit different situations

  • Who This Book Is For

    This book is for working developers with a moderate level of knowledge about Windows Presentation Foundation. It will also be of special interest to ambitious individuals who want to know more about application architecture. It is also suitable for those who just want to learn how to build visually stunning user interfaces.

    What You Will Learn

  • Use MVVM to improve workflow

  • Create visually stunning user interfaces

  • Perform data binds proficiently

  • Implement advanced data validation

  • Locate and resolve errors quickly

  • Master practical animations

  • Improve your applications’ performance

  • In Detail

    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.

    Style and approach

    Filled with intriguing and practical examples, this book delineates concepts that will help you take your WPF skills to the next level.

    Publisher resources

    Download Example Code

    Table of contents

    1. Mastering Windows Presentation Foundation
      1. Mastering Windows Presentation Foundation
      2. Credits
      3. About the Author
      4. About the Reviewer
        1. Why subscribe?
      6. Customer Feedback
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. A Smarter Way of Working with WPF
        1. What is MVVM and how does it help?
          1. Models
          2. View Models
          4. Data binding
          5. So how does MVVM help?
          6. Is there a downside?
        2. Debunking the myth about code behind
        3. Learning how to communicate again
          1. Introducing the ICommand interface
          2. Handling events in Attached Properties
          3. Making use of delegates
        4. Structuring the application code base
        5. Summary
      9. 2. Debugging WPF Applications
        1. Utilizing the Output window
        2. Putting Presentation Trace Sources to work
        3. Discovering inner exceptions
        4. Debugging data bound values
          1. Outputting values to UI controls
          2. Catching changing Dependency Property values
          3. Exploiting converters
        5. Summary
      10. 3. Writing Custom Application Frameworks
        1. What is an application framework?
        2. Encapsulating common functionality
          1. In base classes
          2. Through interfaces
          3. With Extension methods
          4. In UI controls
          5. With converters
        3. Constructing a custom application framework
        4. Separating the Data Access Layer
        5. Providing services
          1. Implementing Dependency Injection
          2. Connecting Views with View Models
        6. Summary
      11. 4. Becoming Proficient with Data Binding
        1. Data binding basics
          1. Binding path syntax
            1. Escaping invalid characters
          2. Exploring the Binding class
            1. Directing data bound traffic
            2. Binding to different sources
          3. Binding with priority
          4. Binding from within control templates
          5. Binding source changes
          6. Converting data bound values
          7. Binding multiple sources to a single target property
        2. Dependency Properties
          1. Setting metadata
          2. Declaring read-only Dependency Properties
          3. Registering Attached Properties
          4. Prioritizing value setting sources
        3. Data templates
          1. Taking complete control
          2. Displaying hierarchical data
        4. Data binding to enumeration collections
        5. Summary
      12. 5. Using the Right Controls for the Job
        1. Investigating the built-in controls
          1. Inheriting framework abilities
          2. Laying it on the line
          3. Containing controls
            1. Canvas
            2. DockPanel
            3. Grid
            4. StackPanel
            5. UniformGrid
            6. WrapPanel
            7. Providing custom layout behavior
          4. Content controls
            1. Presenting content
          5. Items controls
          6. Adorners
        2. Modifying existing controls
          1. Styling
            1. Being resourceful
            2. Merging resources
          2. Triggering changes
          3. Templating controls
          4. Attaching properties
        3. Combining controls
        4. Creating custom controls
        5. Summary
      13. 6. Mastering Practical Animations
        1. Investigating timelines
        2. Introducing key-frames
        3. Telling stories
          1. Controlling storyboards
        4. Easing functions
        5. Animating along a path
        6. Creating everyday animations
        7. Summary
      14. 7. Creating Visually Appealing User Interfaces
        1. Styling applications consistently
          1. Overriding default control styles
          2. Using professional icons
        2. Layering visuals
          1. Throwing shadows
          2. Declaring multiple borders
          3. Reusing composite visuals
          4. Reflecting light
          5. Creating glowing effects
          6. Putting it all together
        3. Moving away from the ordinary
          1. Casting reflections
          2. Exploring borderless windows
          3. Visualizing data
          4. Livening up UI controls
        4. Summary
      15. 8. Implementing Responsive Data Validation
        1. Using validation rules - To do or not to do?
        2. Getting to grips with validation interfaces
          1. Implementing the IDataErrorInfo interface
          2. Introducing the INotifyDataErrorInfo interface
        3. Annotating data
        4. Varying levels of validation
        5. Incorporating multiple validation techniques
        6. Customizing the error template
        7. Avoiding UI-based validation errors
        8. Amalgamating validation and visuals
        9. Summary
      16. 9. Completing That Great User Experience
        1. Providing user feedback
        2. Utilizing multiple threads
          1. Discovering the Async and Await keywords
          2. Building asynchrony into our framework
        3. Going the extra mile
          1. Producing in-application help
          2. Enabling user preferences
          3. Extending common courtesies
          4. Un-burdening the end user
        4. Summary
      17. 10. Improving Application Performance
        1. Leveraging the power of hardware rendering
        2. Making more efficient resources
          1. Freezing objects
        3. Using the right controls for performance
          1. Drawing conclusions
          2. Imaging more efficiently
          3. Enhancing the performance of textual output
            1. Liking the linking
        4. Data binding
          1. Registering Dependency Properties
          2. Binding to collections
        5. Shrinking data objects
        6. Virtualizing collections
        7. Handling events
        8. Summary
      18. 11. Deploying Your Masterpiece Application
        1. Installing Windows applications
        2. Utilizing ClickOnce functionality
          1. Securing deployments
          2. Isolating storage
        3. Accessing application versions
        4. Summary
      19. 12. What Next?
        1. Turning attention to future projects
          1. Improving our application framework
          2. Logging errors
          3. Using online resources

    Product information

    • Title: Mastering Windows Presentation Foundation
    • Author(s): Sheridan Yuen
    • Release date: February 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781785883002