views:

259

answers:

2

I want to pin a WPF window on the desktop (it should be a desktop gadget).

I know you can do this by setting the parent handle of the WPF window to the handle of the "progman" window.

But this does not prevent the hiding of the WPF window when "Windows + D" is pressed.

There must be another way do to this. The new desktop gadgets in Windows 7 are not hidden when "Windows + D" is pressed. How did the MS developers achieve this?

+1  A: 

I think your best bet would be to create a Gadget and host your WPF using either of the following options

1- WPF hosted using an IFrame.
WPF Vista Gadgets - Part 1: Using XBAP and IFRAME

2- WPF hosted in the Gadget using ActiveX
http://blogs.msdn.com/karstenj/archive/2006/10/09/activex-wpf-gadget.aspx
http://blogs.msdn.com/jaimer/archive/2006/10/02/writing-a-.net-activex-control-for-your-sidebar-gadget_2E002E00_.aspx

The linked articles are for Vista but the concepts should be the same since Windows 7 gadgets are backwards compatible with Vista gadgets.

Chris Taylor
A: 

Try this

  1. Create a XBAP Application in VS.

  2. Follow the standard pattern of a Window Gadget.

  3. Call the XBAP app exe from java script in the web page.

  4. Finally zip your directory structure and change its extension to .gadget

your wpf gadget is ready to deploy

Amit Ranjan