Windows Presentation Foundation 4.5 Cookbook
eBook - ePub

Windows Presentation Foundation 4.5 Cookbook

  1. 464 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Windows Presentation Foundation 4.5 Cookbook

About this book

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.

Approach

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.

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.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich in PDF and/or ePUB format, as well as other popular books in Computer Science & Desktop Applications. We have over one million books available in our catalogue for you to explore.

Information

Windows Presentation Foundation 4.5 Cookbook


Table of Contents

Windows Presentation Foundation 4.5 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Instant Updates on New Packt Books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Foundations
Introduction
XAML
XAML and compilation
Dependency properties
Creating custom type instances in XAML
Getting ready
How to do it...
How it works...
There's more...
Creating a dependency property
Getting ready
How to do it...
How it works...
There's more...
Property value inheritance
Why "dependency"?
Dependency property levels
Using an attached property
Getting ready
How to do it...
How it works...
There's more...
Why an attached property?
Does the declaring type "own" the property?
See also
Creating an attached property
Getting ready
How to do it...
How it works...
There's more...
Reusing existing attached properties
See also
Accessing a static property from XAML
Getting ready
How to do it...
How it works...
There's more...
Creating a custom markup extension
Getting ready
How to do it...
How it works...
There's more...
Don't go overboard
Handling routed events
Getting ready
How to do it...
How it works...
There's more...
Stopping bubbling or tunneling
Attached events
2. Resources
Introduction
Using logical resources
Getting ready
How to do it...
How it works...
There's more...
Adding or deleting resources dynamically
Modifying resources
Resources that use other resources
Non-shared resources
Other locations for resources
Dynamically binding to a logical resource
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...
Using binary resources
Getting ready
How to do it...
How it works...
There's more...
Embedded Resource
Accessing binary resources in code
Getting ready
How to do it...
How it works...
There's more...
Accessing binary resources from another assembly
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...
Duplicated keys
3. Layout and Panels
Introduction
The layout process
Coordinates systems in WPF
Creating a table-like user interface
Getting ready
How to do it...
How it works...
There's more...
Shared row/column size
Placement in the same cell
The power of the Grid
Adding rows/columns dynamically
The UniformGrid
Dynamically sizing grid rows/columns
Getting ready
How to do it...
How it works...
There's more...
Creating a scrollable user interface
Getting ready
How to do it...
How it works...
There's more...
Creating a border around panels and elements
Getting ready
How to do it...
How it works...
Placing elements in exact positions
Getting ready
How to do it...
How it works...
There's more...
Canvas has no background
Canvas is not limited to its bounds
Adding/removing elements to a panel dynamically
Getting ready
How to do it...
How it works...
Creating a tabbed user interface
Getting ready
How to do it...
How it works...
There's more...
Implementing drag-and-drop
Getting ready
How to do it...
How it works...
There's more...
Built-in drag-and-drop
Drag-and-drop to other applications
4. Using Standard Controls
Introduction
Working with text
Getting ready
How to do it...
How it works...
There's more...
Using content controls
Getting ready
How to do it...
How it works...
There's more...
Headered content controls
See also
Displaying images
Getting ready
How to do it...
How it works...
There's more...
See also
Creating tooltips
Getting ready
How to do it...
How it works...
There's more...
Deeper tooltip customization
Realistic tooltips
Creating a list of items
Getting ready
How to do it…
How it works...
There's more...
Creating a standard menu
Getting ready
How to do it…
How it works...
There's more...
Other MenuItem properties and events
Creating a context menu
Getting ready
How to do it…
How it works...
There's more...
Selecting options with checkboxes and radio buttons
Getting ready
How to do it…
How it works...
Manipulating tab order and focus
Getting ready
How to do it…
How it works...
There's more...
Keyboard focus versus logical focus
5. Application and Windows
Introduction
Creating a window
Getting ready
How to do it...
How it works...
There's more...
Selecting the startup window dynamically
Accessing command line arguments
Creating a dialog box
Getting ready
How to do it...
How it works...
There's more...
Modeless dialogs
Using the common dialog boxes
Getting ready
How to do it...
How it works...
There's more...
What about colors and fonts?
The Windows API Code Pack
Creating ownership between windows
Getting ready
How to do it...
How it works...
There's more...
Creating a custom shaped window
Getting ready
How to do it...
How it works...
There's more...
What about reusability?
Creating a single instance application
Getting ready
How to do it...
How it works...
There's more...
Handling an unhandled exception
Getting ready
How to do it...
How it works...
There's more...
6. Data Binding
Introduction
Element to element binding
Getting ready
How to do it...
How it works...
...

Table of contents

  1. Windows Presentation Foundation 4.5 Cookbook