user2185985
user2185985

Reputation: 79

Add a WPF Application to Windows Taskbar

I want to dock my WPF application in Windows TaskBar, just like some toolbars like Address works in Windows 7 and WMP works in Win XP.

The WPF app to have a set of 2-3 buttons which the user can directly go ahead and click to do the corresponding operation. I have done some R&D and found about TaskbarItemInfo class. But this does not help the full purpose as the application does not come in the task bar and user has to hover mouse over the minimized icon to get the thumbnail icons and click.

The requirement that I have

  1. Dock the application to the taskbar.
  2. Show some status information.
  3. Show progress information.

There would be 2-3 buttons in the app, thus I want it to dock to taskbar so that user can directly click on it.

Regards Avik Sen

Upvotes: 2

Views: 6547

Answers (1)

Milan Raval
Milan Raval

Reputation: 1882

You can do it like below....

The ThumbButtonInfo also allows to set you Image and on Click you can invoke functionality

<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>

And Button click events

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

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

You can show progress info in...

    <TaskbarItemInfo.ProgressValue></TaskbarItemInfo.ProgressValue>

and Status info in...

  <TaskbarItemInfo.Description></TaskbarItemInfo.Description>

Upvotes: 4

Related Questions