繁体   English   中英

将WPF应用程序添加到Windows任务栏

[英]Add a WPF Application to Windows Taskbar

我想将我的WPF应用程序停靠在Windows TaskBar中,就像某些工具栏一样,在Windows 7中使用Address,在Win XP中使用WMP。

WPF应用程序有一组2-3个按钮,用户可以直接前进并单击以执行相应的操作。 我做了一些研发,发现了TaskbarItemInfo类。 但这并没有帮助完全的目的,因为应用程序没有进入任务栏,用户必须将鼠标悬停在最小化图标上以获取缩略图图标并单击。

我的要求

  1. 将应用程序停靠到任务栏。
  2. 显示一些状态信息。
  3. 显示进度信息。

应用程序中有2-3个按钮,因此我希望它停靠在任务栏上,以便用户可以直接点击它。

关心Avik Sen

你可以像下面这样做....

ThumbButtonInfo还允许您设置Image和on Click可以调用功能

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WpfApplication4" x:Class="WpfApplication4.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo>
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfo Description="Play!" Click="ThumbButtonInfo_Click"/>
                <ThumbButtonInfo Description="Stop!" Click="ThumbButtonInfo_Click_1"  />
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Window.TaskbarItemInfo>
    <Grid>
    </Grid>
</Window>

和按钮单击事件

        private void ThumbButtonInfo_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Clicked");
        }

        private void ThumbButtonInfo_Click_1(object sender, EventArgs e)
        {
            MessageBox.Show("Clicked");
        }

您可以在...中显示进度信息

    <TaskbarItemInfo.ProgressValue></TaskbarItemInfo.ProgressValue>

和...中的状态信息

  <TaskbarItemInfo.Description></TaskbarItemInfo.Description>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM