Anatomy of the Windows 7 taskbar - Progress - Rudi Grobler
Wednesday, November 04, 2009 10:06 AM rudi

Anatomy of the Windows 7 taskbar - Progress

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

Source

Related Posts – Anatomy of the Windows 7 taskbar series

Comments

# Anatomy of th Windows 7 Taskbar - Progres

Wednesday, November 04, 2009 10:18 AM by DotNetKicks.com

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# re: Anatomy of the Windows 7 taskbar - Progress

Wednesday, November 04, 2009 11:25 AM by Jérémy

That's a very cool idea !

# Inter-process Mediator

Sunday, November 22, 2009 2:40 PM by Rudi Grobler

Imagine for a second that you are writing a application like outlook… lets call it MiMail.exe! This application

# Make your WPF buttons color hot-track!

Sunday, November 22, 2009 2:59 PM by Rudi Grobler

One of the cool new features of the Windows 7 taskbar is that all running applications gives you this

# Anatomy of the Windows 7 taskbar ??? Overlays - Rudi Grobler

Pingback from  Anatomy of the Windows 7 taskbar ??? Overlays - Rudi Grobler