Kis*_*mar 18
试试看吧
<ProgressBar Height="25" IsIndeterminate="True" Width="150" Foreground="Red" ></ProgressBar>
Run Code Online (Sandbox Code Playgroud)
如果它不能按您的要求工作,则必须修改Progressbar的Style或ControlTemplate.
要做到这一点,您可以使用Microsoft的Expression Blend,或者您可以获得现有模板的副本并进行修改.
Mar*_*nov 15
不幸的是,它是默认样式的硬编码:
<Trigger Property="IsIndeterminate"
Value="false">
<Setter TargetName="Animation"
Property="Background"
Value="#80B5FFA9"/>
Run Code Online (Sandbox Code Playgroud)
您可以从原始XAML创建自己的样式,或尝试覆盖Loaded事件中的背景,例如:
private void ProgressBar_Loaded(object sender, RoutedEventArgs e)
{
var p = (ProgressBar)sender;
p.ApplyTemplate();
((Panel)p.Template.FindName("Animation", p)).Background = Brushes.Red;
}
Run Code Online (Sandbox Code Playgroud)
但它不可靠
为什么不采取低阻力的路径并使用流行的MahApps库?
设置命名空间: xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
添加'MetroProgressBar'
<controls:MetroProgressBar Height="40"
Background="{StaticResource GrayBrush2}"
BorderBrush="{StaticResource GrayBrush8}"
BorderThickness="3"
Foreground="{StaticResource GrayBrush8}"
IsIndeterminate="False"
Value="{Binding CurrentProgressInfo.ProgressPercent}" />
Run Code Online (Sandbox Code Playgroud)将"前景"设置为您喜欢的颜色
归档时间: |
|
查看次数: |
43564 次 |
最近记录: |