PacktLib: Windows Presentation Foundation 4.5 Cookbook

Windows Presentation Foundation 4.5 Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Foundations

Introduction

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

Resources

Introduction

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

Layout and Panels

Introduction

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

Using Standard Controls

Introduction

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

Application and Windows

Introduction

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

Data Binding

Introduction

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

Commands and MVVM

Introduction

Using routed commands

Implementing a basic MVVM application

Building a simple MVVM framework

Building a complete MVVM style application

Creating an undo/redo system

Styles, Triggers, and Control Templates

Introduction

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

Graphics and Animation

Introduction

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

Custom Elements

Introduction

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

Threading

Introduction

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

Index