Click here to Skip to main content
Licence CPOL
First Posted 23 Aug 2010
Views 4,088
Bookmarked 1 time

Anatomy of the Windows 7 taskbar - Progress

By | 23 Aug 2010 | Technical Blog
(untagged)
Ever noticed the subtle progress overlay while downloading something from the internet? With Windows 7’s new taskbar, applications can visually display their progress on the taskbar!We first need to set the modeTaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);The Window
A Technical Blog article. View original blog here.[^]

Ever noticed the subtle progress overlay while downloading something from the internet? With Windows 7’s new taskbar, applications can visually display their progress on the taskbar!

We first need to set the mode

TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);

The Windows 7 taskbar has 5 possible states

  • NoProgress - No progress is displayed.
  • Indeterminate - The progress is indeterminate (marquee).
  • Normal - Normal progress is displayed.
  • Error - An error occurred (red).
  • Paused - The operation is paused (yellow).

If the state is changed to Normal, the you can also set the value

TaskbarManager.Instance.SetProgressValue(50, 100);

Easy? Isn’t it?

What would a post be without trying to make it just a little easier for the WPF developers? I also created a attached property that auto-magically links a WPF ProgressBar to the Windows 7 taskbar…

Here is my very simple demo

<Window x:Class="ProgressDemo.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:="clr-namespace:ProgressDemo"
    Title="ProgressDemo" Height="100" Width="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Slider Minimum="0" Maximum="100" x:Name="source" Grid.Row="0" />
        <ProgressBar Minimum="0" Maximum="100" Grid.Row="1" Height="20"
             Value="{Binding ElementName=source, Path=Value}" 
             local:Win7.ShowProgressInTaskbar="True" />
    </Grid>
</Window>

As you can see from this XAML, I created a Slider and bound it to the ProgressBar. To make the ProgressBar auto-magically update the Windows 7 taskbar, all we need to do is set the ShowProgressInTaskbar=”True”!!!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

rudigrobler



South Africa South Africa

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralA Tip/Trick... PinmentorSandeep Mewara1:10 23 Aug '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 23 Aug 2010
Article Copyright 2010 by rudigrobler
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid