Control-Level Modal Dialog

25 02 2009

In episode 115 of DNRTV, Billy Hollis shows off a great looking WPF application. It has a number of unique UI features, but one in particular which I loved was the control-level “modal dialog”.

Back at the time, I hacked up a class that would give me the same effect. I’ve had numerous requests for this code on StackOverflow, and I thought appropriate that I get the sample somewhere public. I’ve since integrated it into a product, and while I can’t release that updated source, I can release the original version.

This uses some code from Josh Smith’s Dragging Elements in Canvas CodeProject article

Download here! Note that you must rename the file from DialogPresenterzip.doc to (stupid limitation of WordPress).

An initial list of features that I wanted to add were:

  – Center the child window on the canvas
  – Add resizing capability
  – Add Dialog Templating
  – Add some styling (as you will see, the dialog looks ugly)