新增托盘图标

This commit is contained in:
2026-03-01 10:42:42 +08:00
parent 0ba966cef2
commit e03e1b9766
26 changed files with 582 additions and 72 deletions

View File

@@ -120,6 +120,27 @@
<RowDefinition Height="*" />
<RowDefinition Height="24" />
</Grid.RowDefinitions>
<ms:TrayIcon
x:Name="MyTray"
ClickCommand="{Binding ShowWindowCommand}"
DoubleClickCommand="{Binding ShowWindowCommand}"
IconPath="Resources/Images/authentication.ico"
Tip="我的WPF程序托盘">
<!-- 原生的 WPF 右键菜单 -->
<ms:TrayIcon.ContextMenu>
<ContextMenu>
<!-- 支持普通的 Click 事件 -->
<MenuItem
Click="MenuShow_Click"
FontWeight="Bold"
Header="显示主界面" />
<Separator />
<MenuItem Click="MenuExit_Click" Header="完全退出" />
</ContextMenu>
</ms:TrayIcon.ContextMenu>
</ms:TrayIcon>
<!-- 工具栏 -->
<ToolBarTray Margin="4,4,4,0">
<ToolBar Foreground="{DynamicResource PrimaryFocusedBrush}" Header="工具栏">