Do not play the associated sound. Applies only to notifications. The large version of the icon should be used as the notification icon. Windows 7 and later. Do not display the balloon notification if the current user is in "quiet time", which is the first hour after a new user logs into his or her account for the first time. During this time, most notifications should not be sent or shown. This lets a user become accustomed to a new computer system without those distractions.
Quiet time also occurs for each user after an operating system upgrade or clean installation. A notification sent with this flag during quiet time is not queued; it is simply dismissed unshown. The application can resend the notification later if it is still valid at that time. Because an application cannot predict when it might encounter quiet time, we recommended that this flag always be set on all appropriate notifications by any application that means to honor quiet time.
During quiet time, certain notifications should still be sent because they are expected by the user as feedback in response to a user action, for instance when he or she plugs in a USB device or prints a document.
The handle of a customized notification icon provided by the application that should be used independently of the notification area icon. If this member is NULL , the legacy behavior is carried out.
For more discussion of these notifications, see Balloon tooltips. No more than one balloon notification at a time can be displayed for the taskbar. If an application attempts to display a notification when one is already being displayed, the new notification is queued and displayed when the older notification goes away. In versions of Windows before Windows Vista, the new notification would not appear until the existing notification has been visible for at least the system minimum timeout length, regardless of the original notification's uTimeout value.
If the user does not appear to be using the computer, the system does not count this time toward the timeout. Several members of this structure are only supported for Windows and later. To enable these members, include one of the following lines in your header:. Note that you must initialize the structure with its size. If you use the size of the currently defined structure, the application might not run with earlier versions of Shell You can run your application against earlier versions of Shell However, this might cause problems if your application also needs to run on more recent systems.
You can maintain application compatibility with all Shell Before you initialize the structure, use DllGetVersion to determine which Shell The following code example shows version checking that can enable an application that uses the guidItem member to run on both Windows Vista and Windows 7. This also occurs in the case of a side-by-side installation. When dealing with a side-by-side installation, new versions of the application should update the GUID of the binary file.
A value that specifies the action to be taken by this function. It can have one of the following values:. Adds an icon to the status area. Modifies an icon in the status area. Deletes an icon from the status area. Returns focus to the taskbar notification area. Notification area icons should use this message when they have completed their UI operation. Instructs the notification area to behave according to the version number specified in the uVersion member of the structure pointed to by lpdata.
The version number specifies which members are recognized. The version setting is not persisted once a user logs off. Popup in NetDrives, which provides quick access to all configured shares.
The user can select a share from the grid, double click a share, or open the grid's context menu. Let's recycle the inline ToolTip sample from above, but this time show a Button rather than a TextBlock :. The above markup produces the following pretty ugly result as soon as the user clicks on the NotifyIcon. But at least, it's a Popup :. Per default, the Popup is opened if the left mouse button is being clicked, but you can use the PopupActivation property in order to control which mouse buttons activate your Popup.
You can choose between left, middle, right mouse buttons, or a few common combinations. There's nothing special here - the ContextMenu property is directly derived from the FrameworkElement base class:.
Per default, the context menu is opened if the right mouse button is being clicked, but you can use the MenuActivation property in order to control which mouse buttons open the popup:.
Note : If you define conflicting values for PopupActivation and MenuActivation , the context menu always takes precedence over the Popup :.
The NotifyIcon supports two kinds of balloon tips you can use to show an information in the tray area:. One displays a balloon with a standard icon Info , Warning , Error , None , the other overload shows the balloon with a custom System. Icon instead:. In order to display a custom balloon tip, invoke the ShowCustomBalloon method of the TaskbarIcon class. ShowCustomBalloon not only displays arbitrary UIElement instances, but also provides some basic animations out of the box and an optional time span that defines a timeout for the balloon.
You can also close a balloon programmatically or abort the closing timer e. Have a look at the showcase in the sample applications for a few scenarios. The last part of this tutorial does not exactly require that your are a WPF-Ninja, but it's assumed that you are familiar with the concepts behind commands, routed events, or data binding.
In case you get lost, just post a question on the forum and I and hopefully others, too will try to point you in the right direction. Commands provide a clean way to react to events on your NotifyIcon without having to hook up event listeners.
TaskbarIcon currently exposes two properties that allow you to assign a command:. To get started, here's a simple command called ShowMessageCommand , which just displays a message dialog.
The dialog text is taken from the command parameter:. In the snippet below, I declared the command as a local resource:. You'll find this sample along with all other snippets in this article in the sample application.
Note that the LeftClickCommand fires after a short delay as opposite to the DoubleClickCommand that fires immediately. This is because there is a time span between a first click and a second click for the OS to consider the mouse action a double-click. The NotifyIcon is smart enough to wait this period in order to make sure the LeftClickCommand is only fired if the user does not click a second time within that period. Binding to the TaskbarIcon class that manages your ToolTip , Popup , context menu, or balloon tip is pretty easy.
There are two variants which are both shown in the sample application :. In order to simplify data binding scenarios for you, the TaskbarIcon class tries to set the DataContext of ToolTip s, Popup s, context menus and custom balloon messages according to the following rules:.
0コメント