This is a mirror of official site: http://jasper-net.blogspot.com/

WPF TaskDialog Wrapper and Emulator

| Sunday, September 23, 2012
Inline image 2

The Short Version

Really quickly, here's what you need to know: 

Visual Studio 2010 solution in .NET 4.0 for WPF applications
Uses native TaskDialogIndirect calls when available (Vista/7)
Uses an emulated WPF version when not (XP)
Provides seamless fallback, lots of customizability, and detailed return results
Completely free to use or modify
Lots of improvements in v1.5+ — see below!
Introduction

I've been a big fan (and user) of Hedley Muscroft's WinForms emulator and wrapper for TaskDialogs. In that same spirit, I've taken part of his hard work (and, by succession, KevinGre's) and done something very similar, but this time for WPF (and .NET 4.0).

Background

There are tons of other WPF/WinForms TaskDialog implementations out there, either those that wrap the Win32 APIs, or just providing a custom WPF dialog to use. A quick web search will find you plenty. What they don't give you is a unified way to use the native dialog that still works on older versions of Windows. I go into more detail on the rationale and history of all this in a blog post here.

Hedley's work is great and I've used it plenty of times, but I wanted something very similar that worked for WPF apps. I also thought I might take the time to try to improve on it, mostly thanks to the power of WPF and .NET 4.0.

Using the Code

For the most part, you'll only care about the TaskDialog class' static methods for invoking a dialog. I wanted it to sort of mimic the ease of use that the traditional MessageBox class has always given us. There are two other major classes that you'll use with the static methods:

TaskDialogOptions
TaskDialogResult
For cases where you need complete control over the customization of the task dialog, you'll have to create an options object and pass it in to the Show method. This means you can't exactly do a one-line method call anymore, but it does give you the most control in cases where that is important.

Read more:  Codeproject
QR: Inline image 1

Posted via email from Jasper-net

0 comments: