我想将ProgressDialog内部进度条的颜色更改为HighlightColor。
使用CustomResourceDictionary我设法更改按钮样式但不更改进度条的颜色
MetroDialogOptions.CustomResourceDictionary = new ResourceDictionary
{
Source = new Uri("pack://application:,,,/GUI;component/Styles/DialogDictionary.xaml")
};
DialogDictionary.xaml:
<Style x:Key="AccentedDialogSquareButton"
BasedOn="{StaticResource HighlightedSquareButtonStyle}"
TargetType="{x:Type ButtonBase}">
<Setter Property="Controls:ControlsHelper.ContentCharacterCasing" Value="Normal" />
</Style>
<Style TargetType="{x:Type Dialog:ProgressDialog}"
x:Key="NewProgressDialogStyle"
BasedOn="{StaticResource {x:Type Dialog:ProgressDialog}}">
<Setter Property="ProgressBarForeground" Value="Red" />
</Style>
<Style TargetType="{x:Type Dialog:ProgressDialog}"
BasedOn="{StaticResource NewProgressDialogStyle}" />
答案 0 :(得分:0)
目前无法做到这一点。
使用SetResourceReference
方法将ProgressBarForeground
属性设置为本地值,因此使用Setter
中的Style
无效 - 本地值始终具有优先级高于来自Style
的优先级。
您可以尝试覆盖自定义词典中的AccentColorBrush
资源,但这不会起作用,因为Mahapps中的当前主题代码将扫描对话框的所有合并资源字典并将此资源替换为特殊的,被定义为&#34;主题强调颜色&#34;。
有关详细信息,请参阅ThemeManager
源代码。
您只有两个选择:
ProgressDialog