C# ProgressBar的默认前景色
我一直在使用C# ProgressBar的默认前景色,c#,wpf,progress-bar,systemcolors,system.windows.media,C#,Wpf,Progress Bar,Systemcolors,System.windows.media,我一直在使用画笔和画笔库中的System.Windows.Media类从我的C#code更改ProgressBar控件的前景色。但是,我想知道.Net是否提供了对ProgressBar的原始默认前景色的访问,以便在我想要恢复时使用 例如: 现在我引用了@Beauty on提供的一个答案,它使用了这个类SystemColor似乎是提供控件默认笔刷颜色的.Net类,但在Progressbar的前景中没有看到笔刷。这种颜色可以在SystemColors中获得,还是有其他方法获得 我如何更改颜色的示例
画笔和画笔库中的System.Windows.Media
类从我的C#code更改ProgressBar
控件的前景色。但是,我想知道.Net是否提供了对ProgressBar
的原始默认前景色的访问,以便在我想要恢复时使用
例如:
现在我引用了@Beauty on提供的一个答案,它使用了这个类SystemColor
似乎是提供控件默认笔刷颜色的.Net类,但在Progressbar
的前景中没有看到笔刷。这种颜色可以在SystemColors
中获得,还是有其他方法获得
我如何更改颜色的示例:
XAML:
ProgressBar
控件的默认样式(可在此找到,您可以在上面找到)显示默认前景色为:
#FF01D328
这可能与系统颜色很匹配,但除此之外,只需使用它即可
<ProgressBar Name="Progress" Foreground="{Binding LoadScreenModel.BarColor}" />
private Brush _barColor = Brushes.Red;
public Brush BarColor
{
get { return _barColor; }
set
{
_barColor = value;
NotifyPropertyChange(() => BarColor);
}
}