我正在制作一个新的WPF应用程序,我需要能够最小化应用程序,并且在系统托盘中,在时钟旁边(或在那个一般区域)中保持良好和舒适.
这必须适用于Windows XP,Vista和7.我不必支持旧版本的Windows.
如果我使用.NET 4,最简单的方法是什么?
极少数人有这样的问题,他们无法对子菜单项做出反应,因为在鼠标到达子菜单之前子菜单项关闭得太快。在底部添加了一个 GIF。我们无法重现这种行为,而且它似乎只影响极少数人。

我们使用 Hardcodet.Wpf.TaskbarIcon 来显示菜单。任何想法,将不胜感激。以下是代码片段,其中我只说明了 1 个菜单项,但其他菜单项遵循相同的逻辑:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:local="clr-namespace:FreedomPlatform"
xmlns:converters="clr-namespace:FreedomPlatform.Converters">
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
<converters:InverseAndBooleanConverter x:Key="InverseAndBooleanConverter" />
<Style TargetType="{x:Type MenuItem}">
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<ContextMenu x:Key="FreedomTrayMenu" AutomationProperties.Name="Freedom">
<MenuItem Header="Options">
<MenuItem Header="Run on Startup" StaysOpenOnClick="True" IsCheckable="True" IsChecked="{Binding RunOnStartup}" IsEnabled="{Binding RunOnStartupModificationEnabled}" />
</MenuItem>
<Separator />
</ContextMenu>
<tb:TaskbarIcon x:Key="FreedomNotifyIcon"
IconSource="{Binding StatusIconPath}"
ContextMenu="{StaticResource FreedomTrayMenu}" MenuActivation="LeftOrRightClick" KeyUp="{Binding OnKeyUp}">
<!-- Self-assign a data context (could also be done programmatically) -->
<tb:TaskbarIcon.DataContext>
<local:StatusViewModel />
</tb:TaskbarIcon.DataContext>
</tb:TaskbarIcon>
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)