Book description
Gain comprehensive insight into WPF mechanics and capabilities.
About This Book
- Gain a strong foundation in WPF features and patterns
- Leverage the MVVM pattern to build decoupled, maintainable apps
- Increase efficiency through Performance tuning and UI automation
Who This Book Is For
The book is intended for developers who are relatively new to WPF (Windows Presentation Foundation), or those who have been working with WPF for some time, but want to get a deeper understanding of its foundation and concepts to gain practical knowledge. Basic knowledge of C# and Visual Studio is assumed.
What You Will Learn
- Understand the fundamentals of WPF
- Explore the major controls and manage element layout
- Implement data binding
- Create custom elements that lead to a particular implementation path
- Customize controls, styles, and templates in XAML
- Leverage the MVVM pattern to maintain a clean and reusable structure in your code
- Master practical animations
- Integrate WCF services in a WPF application
- Implement WPFs support for debugging and asynchronous operations
In Detail
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.
Style and approach
This book takes a recipe-based approach to teaching you how to create fault-tolerant WPF applications.
Table of contents
- Title Page
- Copyright and Credits
- Packt Upsell
- Contributors
- Preface
-
WPF Fundamentals
- Introduction
- The WPF Architecture
- Presentation Framework
- Presentation Core
- Common Language Runtime
- Media Integration Library
- OS Core
- Types of WPF applications
- The XAML overview
- XAML syntax terminologies
- Object element syntax
- Property Attribute syntax
- Property Element syntax
- Content syntax
- Collection syntax
- Event Attribute syntax
- Installing WPF Workload with Visual Studio 2017
- Getting ready
- How to do it...
- Creating WPF applications
- Getting ready
- How to do it...
- There's more...
- Creating and navigating from one window to another
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating and navigating from one page to another
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating a dialog box
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using the open file dialog
- Using the save file dialog
- Using the print dialog
- Other common dialogs
- Creating ownership between windows
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating a single instance application
- Getting ready
- How to do it...
- How it works...
- There's more...
- Passing arguments to WPF applications
- Getting ready
- How to do it...
- How it works...
- There's more...
- Handling unhandled exceptions
- Getting ready
- How to do it...
- How it works...
- There's more...
-
Using WPF Standard Controls
- Introduction
- Using the TextBlock control to add plain text
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using Label to add other controls in text
- Getting ready
- How to do it...
- How it works...
- There's more...
- Providing a user option to input text
- Getting ready
- How to do it...
- How it works...
- There's more...
- Windows Clipboard support
- Adding spellcheck support
- Adding images to your application UI
- Getting ready
- How to do it...
- How it works...
- There's more...
- Working with ready-to-use 2D shapes
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding tooltips to show additional information
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding a standard menu to the WPF application
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding an access key to menus
- Adding icons to menus
- Adding checkable menu items
- Adding click-event handlers to menus
- Providing extra functionalities using the context menu
- Getting ready
- How to do it...
- How it works...
- Adding user options with radio buttons and checkboxes
- Getting ready
- How to do it...
- How it works...
- There's more...
- Working with the progress bar control
- Getting ready
- How to do it...
- How it works...
- Using the Slider control to pick a numeric value
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using the Calendar control in your application
- Getting ready
- How to do it...
- How it works...
- There's more...
- The SelectionModes property
- The DisplayDate property
- The DisplayMode property
- The BlackoutDates property
- Listing items in a Listbox control
- Getting ready
- How to do it...
- How it works...
- There's more...
- Implementing multi selection
- Customizing the ListBoxItem with multiple controls
- Providing options to select from a ComboBox
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding a status bar to your window
- Getting ready
- How to do it...
- How it works...
- Adding a toolbar panel to perform quick tasks
- Getting ready
- How to do it...
- How it works...
-
Layouts and Panels
- Introduction
- Building a UI layout using a Grid
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating a resizable Grid
- Spanning elements across multiple rows and/or columns
- Placing elements in uniform cells
- Getting ready
- How to do it...
- How it works...
- There's more...
- Setting the row and column count
- Defining the first cell of the UniformGrid
- Filling elements from right to left
- Automatically repositioning controls using WrapPanel
- Getting ready
- How to do it...
- How it works...
- There's more...
- Placing controls in a Stack
- Getting ready
- How to do it...
- How it works...
- There's more...
- Positioning controls inside a Canvas
- Getting ready
- How to do it...
- How it works...
- There's more...
- Wrapping UI elements using a Border
- Getting ready
- How to do it...
- How it works...
- Creating a scrollable panel
- Getting ready
- How to do it...
- How it works...
- Docking controls using the DockPanel
- Getting ready
- How to do it...
- How it works...
- There's more...
- Rescaling UI elements using a ViewBox
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating a tabbed layout
- Getting ready
- How to do it...
- How it works...
- Dynamically adding/removing elements in a panel
- Getting ready
- How to do it...
- How it works...
- There's more...
- Implementing the drag and drop feature
- Getting ready
- How to do it...
- How it works...
- There's more...
-
Working with Data Bindings
- Introduction
- Working with CLR properties and UI notifications
- Getting ready
- How to do it...
- How it works...
- There's more...
- Working with dependency properties
- Getting ready
- How to do it...
- How it works...
- There's more...
- Working with attached properties
- Getting ready
- How to do it...
- How it works...
- Data binding to an object
- Getting ready
- How to do it...
- How it works...
- Data binding to a collection
- Getting ready
- How to do it...
- How it works...
- There's more...
- Element-to-element data binding
- Getting ready
- How to do it...
- How it works...
- Sorting data in a DataGrid control
- Getting ready
- How to do it...
- How it works...
- Grouping data in a DataGrid control
- Getting ready
- How to do it...
- How it works...
- There's more...
- Filtering data in a DataGrid control
- Getting ready
- How to do it...
- How it works...
- Using static bindings
- Getting ready
- How to do it...
- How it works...
- Using value converters
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using multi-value converters
- Getting ready
- How to do it...
- How it works...
-
Using Custom Controls and User Controls
- Introduction
- Creating a custom control
- Getting ready
- How to do it...
- How it works...
- There's more...
- XMLNS attribute declaration
- Default styling
- Toolbox integration
- Customizing the template of a custom control
- Getting ready
- How to do it...
- How it works...
- Exposing properties from the custom control
- Getting ready
- How to do it...
- How it works...
- Exposing events from a custom control
- Getting ready
- How to do it...
- How it works...
- Extending the functionality of a control using behavior
- Getting ready
- How to do it...
- How it works...
- Creating a User Control interface
- Getting ready
- How to do it...
- How it works...
- Exposing events from a User Control
- Getting ready
- How to do it...
- How it works...
- Customizing the XMLNS namespace
- Getting ready
- How to do it...
- How it works...
-
Using Styles, Templates, and Triggers
- Introduction
- Creating the style of a control
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating the Style of a control based on another Style
- Getting ready
- How to do it...
- How it works...
- Applying Style to a control automatically
- Getting ready
- How to do it...
- How it works...
- Editing the template of any control
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating a property trigger
- Getting ready
- How to do it...
- How it works...
- Creating a multi trigger
- Getting ready
- How to do it...
- How it works...
- Creating a data trigger
- Getting ready
- How to do it...
- How it works...
- Creating a multi data trigger
- Getting ready
- How to do it...
- How it works...
- Creating an event trigger
- Getting ready
- How to do it...
- How it works...
-
Using Resources and MVVM Patterns
- Introduction
- Using binary resources inside a WPF application
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using binary resources from another assembly
- Getting ready
- How to do it...
- How it works...
- There's more...
- Accessing binary resources in code
- Getting ready
- How to do it...
- How it works...
- Using static logical resources in WPF
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using dynamic logical resources in WPF
- Getting ready
- How to do it...
- How it works...
- There's more...
- Managing logical resources
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using user selected colors and fonts
- Getting ready
- How to do it...
- How it works...
- There's more...
- Building an application using the MVVM pattern
- Getting ready
- How to do it...
- How it works...
- Using routed commands in a WPF application
- Getting ready
- How to do it...
- How it works...
-
Working with Animations
- Introduction
- Scaling an element while rendering
- Getting ready
- How to do it...
- How it works...
- Rotating an element while rendering
- Getting ready
- How to do it...
- How it works...
- Skewing an element while rendering
- Getting ready
- How to do it...
- How it works...
- Moving an element while rendering
- Getting ready
- How to do it...
- How it works...
- Grouping multiple transforms
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating property-based animations
- Getting ready
- How to do it...
- How it works...
- Creating path-based animations
- Getting ready
- How to do it...
- How it works...
- Creating key-frame-based animations
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding easing effects to animations
- Getting ready
- How to do it...
- How it works...
- There's more...
- BounceEase
- CircleEase
- CubicEase
- ElasticEase
- ExponentialEase
- PowerEase
- QuadraticEase
- QuarticEase
- QuinticEase
- SineEase
-
Using WCF Services
- Introduction
- Creating a WCF service
- Getting ready
- How to do it...
- How it works...
- The DataContract attribute
- The DataMember attribute
- The ServiceContract attribute
- The OperationContract attribute
- Self-hosting a WCF service
- Getting ready
- How to do it...
- How it works...
- There's more...
- Hosting a WCF service in an IIS server
- Getting ready
- How to do it...
- How it works...
- Integrating a WCF service in a WPF application
- Getting ready
- How to do it...
- How it works...
- There's more...
-
Debugging and Threading
- Introduction
- Enabling the UI debugging tool for XAML
- Getting ready
- How to do it...
- Navigating through XAML elements using Live Visual Tree
- Getting ready
- How to do it...
- How it works...
- There's more...
- Inspecting XAML properties using Live Property Explorer
- Getting ready
- How to do it...
- How it works...
- There's more...
- Updating the UI from a non-UI thread
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding cancelation support to long running threads
- Getting ready
- How to do it...
- How it works...
- Using the background worker component
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using a timer to periodically update the UI
- Getting ready
- How to do it...
- How it works...
-
Interoperability with Win32 and WinForm
- Introduction
- Hosting WinForm controls in WPF applications
- Getting ready
- How to do it...
- How it works...
- There's more...
- Hosting WPF controls in WinForm applications
- Getting ready
- How to do it...
- How it works...
- Calling Win32 APIs from WPF applications
- Getting ready
- How to do it...
- How it works...
- Embedding ActiveX controls in WPF applications
- Getting ready
- How to do it...
- How it works...
- Other Books You May Enjoy
Product information
- Title: Windows Presentation Foundation Development Cookbook
- Author(s):
- Release date: February 2018
- Publisher(s): Packt Publishing
- ISBN: 9781788399807
You might also like
book
Windows Presentation Foundation 4.5 Cookbook
For C# developers, this book offers a fast route to getting more closely acquainted with the …
book
Mastering Windows Presentation Foundation
Master the art of building modern desktop applications on Windows About This Book Learn how to …
video
Windows Presentation Foundation Basics
In this Windows Presentation Foundation Basics training course, expert author Mark Long will teach you the …
book
Hidden WPF: Secrets for Creating Great Applications in Windows Presentation Foundation
Get tips and tricks to help you create great WPF applications, exploring possibilities that you’ve probably …