有没有办法创建一个 Windows 10 应用程序,它驻留在任务栏中,类似于 People App?
Is there a way to create a Windows 10 app that reside in taskbar similar to People App?
我想创建一个类似于任务栏上的图标的解决方案,单击后它将作为任务栏上方的一个小弹出窗口打开,不会打扰用户或其他 windows 类似于Microsoft People 应用程序将显示在右下角,如下图所示:
这个问题的标题与我的问题相似,但提问者要求 UWP 应用程序的 AppBar 的主题不同,这不是我的本意。
有没有办法为普通开发者、企业公司或微软合作伙伴做到这一点?
这是我最接近我需要的。
尽管它使用的是 ElectronJS 而不是 WPF 或 UWP。但是因为它在 ElectronJS 上是可行的,那么它在 WPF 上也应该是可行的。
第三次更新:
最近我尝试构建应用程序,在此 repo 中共享 https://github.com/ejabu/TrayApp
注意事项:
- Window风格
获得像 People App 这样的无边界 window。
<!-- MainWindow.xaml -->
<Window
....
WindowStyle="None">
<Grid/>
</Window>
- ShowInTaskbar
ShowInTaskbar -> False
防止它出现在任务栏上
<!-- MainWindow.xaml -->
<Window
....
ShowInTaskbar="False"
...>
<Grid/>
</Window>
- 使用隐藏方法
/// MainWindow.xaml.cs
private void Hide_Window()
{
this.Hide(); /// Minimize Window
}
- 根据任务栏调整位置
/// MainWindow.xaml.cs
private void AdjustWindowPosition()
{
Screen sc = Screen.FromHandle(new WindowInteropHelper(this).Handle);
if (sc.WorkingArea.Top > 0)
{
Rect desktopWorkingArea = SystemParameters.WorkArea;
Left = desktopWorkingArea.Right - Width;
Top = desktopWorkingArea.Top;
}
else if ((sc.Bounds.Height - sc.WorkingArea.Height) > 0)
{
Rect desktopWorkingArea = SystemParameters.WorkArea;
Left = desktopWorkingArea.Right - Width;
Top = desktopWorkingArea.Bottom - Height;
}
else
{
Rect desktopWorkingArea = SystemParameters.WorkArea;
Left = desktopWorkingArea.Right - Width;
Top = desktopWorkingArea.Bottom - Height;
}
}
第二次更新:
https://github.com/AronDavis/TwitchBot/blob/master/TwitchBotApp/Notification.xaml
更新:
https://www.youtube.com/watch?v=jdvD55ir1is
原创:
这是很好的例子
最终结果
Window 页面没有关闭按钮。而且也不能通过评论这一行来拖动https://github.com/ejabu/AcrylicWindow/blob/343f4f5a6bc23109a97640f9ac35facb31e9ae43/AcrylicWindow/MainWindow.xaml.cs#L30
我在这里找到了示例项目
https://github.com/shenchauhan/MyPeople/tree/master/MyPeople/MyPeople
那我们可以看看MyPeopleCanvas
我发现微软也有新的更新,也许我们可以在不久的将来用文本替换系统托盘图标中的图标图像。
我想创建一个类似于任务栏上的图标的解决方案,单击后它将作为任务栏上方的一个小弹出窗口打开,不会打扰用户或其他 windows 类似于Microsoft People 应用程序将显示在右下角,如下图所示:
这个问题的标题与我的问题相似,但提问者要求 UWP 应用程序的 AppBar 的主题不同,这不是我的本意。
有没有办法为普通开发者、企业公司或微软合作伙伴做到这一点?
这是我最接近我需要的。 尽管它使用的是 ElectronJS 而不是 WPF 或 UWP。但是因为它在 ElectronJS 上是可行的,那么它在 WPF 上也应该是可行的。
第三次更新:
最近我尝试构建应用程序,在此 repo 中共享 https://github.com/ejabu/TrayApp
注意事项:
- Window风格
获得像 People App 这样的无边界 window。
<!-- MainWindow.xaml -->
<Window
....
WindowStyle="None">
<Grid/>
</Window>
- ShowInTaskbar
ShowInTaskbar -> False
防止它出现在任务栏上
<!-- MainWindow.xaml -->
<Window
....
ShowInTaskbar="False"
...>
<Grid/>
</Window>
- 使用隐藏方法
/// MainWindow.xaml.cs
private void Hide_Window()
{
this.Hide(); /// Minimize Window
}
- 根据任务栏调整位置
/// MainWindow.xaml.cs
private void AdjustWindowPosition()
{
Screen sc = Screen.FromHandle(new WindowInteropHelper(this).Handle);
if (sc.WorkingArea.Top > 0)
{
Rect desktopWorkingArea = SystemParameters.WorkArea;
Left = desktopWorkingArea.Right - Width;
Top = desktopWorkingArea.Top;
}
else if ((sc.Bounds.Height - sc.WorkingArea.Height) > 0)
{
Rect desktopWorkingArea = SystemParameters.WorkArea;
Left = desktopWorkingArea.Right - Width;
Top = desktopWorkingArea.Bottom - Height;
}
else
{
Rect desktopWorkingArea = SystemParameters.WorkArea;
Left = desktopWorkingArea.Right - Width;
Top = desktopWorkingArea.Bottom - Height;
}
}
第二次更新:
https://github.com/AronDavis/TwitchBot/blob/master/TwitchBotApp/Notification.xaml
更新:
https://www.youtube.com/watch?v=jdvD55ir1is
原创:
这是很好的例子
最终结果
Window 页面没有关闭按钮。而且也不能通过评论这一行来拖动https://github.com/ejabu/AcrylicWindow/blob/343f4f5a6bc23109a97640f9ac35facb31e9ae43/AcrylicWindow/MainWindow.xaml.cs#L30
我在这里找到了示例项目
https://github.com/shenchauhan/MyPeople/tree/master/MyPeople/MyPeople
那我们可以看看MyPeopleCanvas
我发现微软也有新的更新,也许我们可以在不久的将来用文本替换系统托盘图标中的图标图像。