开发者

Best way to animate arrow levitating over notification area in WPF

开发者 https://www.devze.com 2023-02-17 12:48 出处:网络
At some point in my app the main window closes and the application continues to run as a system tray icon.

At some point in my app the main window closes and the application continues to run as a system tray icon.

Whenever this happens, I want to show the user, that the app is now in the notification area as an icon. I could just show a tooltip, but it's not cool anymore.

Instead, I want to levitate a big arrow over an icon, to be sure that the user sees it.

Here is how it's done in DropBox application:

http://img59.imageshack.us/img59/9364/arrowva.png

What is the best way to create and animate this arrow in WPF:

  1. A custom shape window? If so, what will do the animation. Can I apply storyboard animation to a window itself?
  2. A transparent larger window, but with arrow as an Image, and animate it with storyboard? But than, I will have the window capture mouse clicks, which is not desired.
  3. Some other a开发者_开发问答pproach?

Thank you.


You can use Popup with explicit position:

<Popup AllowTransparency="True" IsOpen="True" Placement="AbsolutePoint"
       HorizontalOffcet="{x:Static namespace:TrayInfo.LocationX}"
       VerticalOffcet="{x:Static namespace:TrayInfo.LocationY}" >
    <views:YourViewWithAnimatingArrowImage DataContext="{Binding ifYouNeed}" />
</Popup>

TrayInfo


since u can't really animate a window, (it's a user32 thing, not a wpf element), I'd go with option 2.

0

精彩评论

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