Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animate the Window movements from tray

Tags:

wpf

In my project I am sending the window to tray on close. How can I give an animated effect for this ie, the movement from the current window position to tray. And also the reverse, means on double clicking on the notifyicon in tray, the window is coming to front?

like image 756
Sauron Avatar asked Sep 04 '09 08:09

Sauron


1 Answers

I've not done much in WPF so please bear that in mind.

It seems that this can be done through the windows API using DrawAnimatedRects as described here (Worth reading as it highlights some pitfalls)

This has been converted to VB2005 here

You could build something which encapsulates this functionality but it feels a little hacky to me. In addition, I've not tried to access the API directly from a WPF project - I'm assuming it's possible but can't guarantee it.

Next best suggestion would be to investigate the Windows® API Code Pack for Microsoft® .NET Framework. I haven't had a chance to dig through this yet but there's a chance it may expose the functionality in a managed way.

In short, it looks like the other apps that include this functionality handle it themselves through the API rather than relying on the framework.

like image 98
Basic Avatar answered Oct 31 '22 13:10

Basic