CSDeskBand icon indicating copy to clipboard operation
CSDeskBand copied to clipboard

[WPF] Using a Window as UIElement

Open srwi opened this issue 5 years ago • 2 comments

I am trying to use a Window instead of a simple UserControl so I can take advantage of its Activated and Deactivated events. However the deskband does not show.

Steps to reproduce:

  1. Open the WPF sample project
  2. Create a new window Window1
  3. Change line 23 in Deskband.cs to: protected override UIElement UIElement => new Window1();

Alternatively, is there any other way to detect if the deskband (including all of its child windows) get deactivated?

srwi avatar Apr 07 '19 16:04 srwi

Haven't really played with wpf windows but I think they are a bit different. I know that winforms windows (Forms) work fine. I tried out the steps above and I see that the error is because a window has to be top level and can't be a child. I remember I was able to use a window before though when I was experimenting, I'll update if I remember.

I also don't know much about the deactivated so that needs some investigation too.

dsafa avatar Apr 08 '19 06:04 dsafa

If you change it so that you get the handle from new WindowInteropHelper(window).Handle it will work.

dsafa avatar May 09 '19 20:05 dsafa