Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有多种颜色WPF的Progressbar_Wpf_Progress Bar - Fatal编程技术网

带有多种颜色WPF的Progressbar

带有多种颜色WPF的Progressbar,wpf,progress-bar,Wpf,Progress Bar,我试图使我的progressbar看起来像这样: 但我有这个: 这是我的代码(我为progressbar创建了一个带有指示器属性“fill”的样式): 欢迎来到SO 只需将该指示器的宽度设置为与父ProgressBar的宽度相同: <Rectangle x:Name="Indicator" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ProgressBar}}"> 简单

我试图使我的progressbar看起来像这样:

但我有这个:

这是我的代码(我为progressbar创建了一个带有指示器属性“fill”的样式):


欢迎来到SO

只需将该指示器的宽度设置为与父ProgressBar的宽度相同:

<Rectangle x:Name="Indicator" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ProgressBar}}">


简单

当进度值更改时,您应该更新渐变笔刷,动画或触发器似乎是一个解决方案抱歉,我的坏外观看起来像是正在进行颜色更改的部分,是“动画”而不是“指示器”,我使用了您的代码,但这一次使用“动画”,效果非常好。谢谢
<Rectangle x:Name="Indicator" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ProgressBar}}">