Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPF] Using a Window as UIElement #39

Open
srwi opened this issue Apr 7, 2019 · 2 comments
Open

[WPF] Using a Window as UIElement #39

srwi opened this issue Apr 7, 2019 · 2 comments

Comments

@srwi
Copy link

srwi commented Apr 7, 2019

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?

@dsafa
Copy link
Owner

dsafa commented Apr 8, 2019

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
Copy link
Owner

dsafa commented May 9, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants