Using TaskBarItemInfo in WPF for the progress bar in the Win 7 taskbar

Does anyone have a WPF example of updating ProgressState through available enumeration states when moving through ProgressValue?

I have the following code that binds my run value to run from 0 to 1:

<Window.TaskbarItemInfo>
    <TaskbarItemInfo Description="An app with a taskbar info description" 
                     ProgressValue="{Binding Count}" ProgressState="Normal"/>
</Window.TaskbarItemInfo>

But, what is a good way to switch from No to Normal to No or other threads: No-Normal- Suspended-Normal-None . In the above code, the progress bar on the left is displayed at 0%, and then ends at 100% (1). I suppose I could associate this with a converter for another property hanging in my ViewModel, but wanted to see if anyone had any slicker solutions.

Thank!

+5
source share
2 answers

ProgressValue - double use a value from 0 to 1

+3
source

Just like you bind ProgressValue, you can also bind ProgressState. The ProgressState type is an enumeration called TaskbarItemProgressState that includes the states that you have already mentioned.

public enum TaskbarItemProgressState
{
    // Summary:
    //     No progress indicator is displayed in the taskbar button.
    None = 0,
    //
    // Summary:
    //     A pulsing green indicator is displayed in the taskbar button.
    Indeterminate = 1,
    //
    // Summary:
    //     A green progress indicator is displayed in the taskbar button.
    Normal = 2,
    //
    // Summary:
    //     A red progress indicator is displayed in the taskbar button.
    Error = 3,
    //
    // Summary:
    //     A yellow progress indicator is displayed in the taskbar button.
    Paused = 4,
}

I think that the “weakest” ways to do this are the methods you already mentioned, either using a converter or manually

+2
source

All Articles