开发者

how can I control the opacity and z-order of the top level window in WPF?

开发者 https://www.devze.com 2022-12-12 21:53 出处:网络
I would like to make a small WPF app window semi-transparent and on top of other windows. When I change settings on the top level Window it only seems to effect the co开发者_JAVA技巧ntents, not the t

I would like to make a small WPF app window semi-transparent and on top of other windows.

When I change settings on the top level Window it only seems to effect the co开发者_JAVA技巧ntents, not the titlebar or border.

Is this possible with WPF??

Thanks


WindowStyle and AllowsTransparency are the two properties you'll have to change.

In order to have your window sit on top of all the other windows, you're going to want to set Window.Topmost to True as well. To move the window, handle one of the Mouse events on the border you added then call Window.DragMove in the event handler.


I'm not sure this is the best answer, but:

AllowsTransparency="True" WindowStyle="None"

gets rid of the title and border -- now Opacity effects everything else. I then added my own border and Close button. Now I just need some Move functionality.

AllowsTransparency seems to do the trick, but it forces WindowStyle to None.

0

精彩评论

暂无评论...
验证码 换一张
取 消