将WPF中的TaskBarItemInfo用于Win 7任务栏中的进度条
是否有人在通过ProgressValue时通过可用的枚举状态更新ProgressState的WPF示例 我有以下代码将我的进度值绑定为从0运行到1:将WPF中的TaskBarItemInfo用于Win 7任务栏中的进度条,wpf,windows-7,progress-bar,taskbar,Wpf,Windows 7,Progress Bar,Taskbar,是否有人在通过ProgressValue时通过可用的枚举状态更新ProgressState的WPF示例 我有以下代码将我的进度值绑定为从0运行到1: <Window.TaskbarItemInfo> <TaskbarItemInfo Description="An app with a taskbar info description" ProgressValue="{Binding Count}" ProgressState
<Window.TaskbarItemInfo>
<TaskbarItemInfo Description="An app with a taskbar info description"
ProgressValue="{Binding Count}" ProgressState="Normal"/>
</Window.TaskbarItemInfo>
但是,从None到Normal到None或其他流程的好方法是什么:None Normal暂停Normal None。
上面的代码在左侧以0%显示进度条,然后以100%(1)结束。
我想我可以用一个转换器将它绑定到我的ViewModel的另一个属性上,但我想看看是否有人有更巧妙的解决方案
谢谢 ProgressValue是双精度的
使用0到1之间的值,与绑定ProgressValue的方式相同,也可以绑定ProgressState。ProgressState的类型是一个名为TaskbarItemProgressState的枚举,其中包括您已经提到的状态
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,
}
我认为实现这一点的“最灵活”的方法是您已经提到的方法,可以使用转换器,也可以手动进行更清楚地说,我的视图模型在0到1的范围内递增(0.1)。但是将XAML ProgressState设置为代码段中的Normal太静态了。需要按所述循环状态。一件小事:任务栏进度似乎与主题相关,而不仅仅与windows版本相关,这意味着在使用经典主题(无aero)的windows 7下,您将永远看不到它;/但是Windows7的问题应该很快得到“解决”:我知道ProgressValue,问题是关于ProgressState的。