[英]How to set DisplayDateTimeStart on WPF (MahApps.Metro) datetime picker
[英]How to set ProgressBarForeground in MahApps.Metro ProgressDialog?
我想將ProgressDialog內進度條的顏色更改為HighlightColor。
使用CustomResourceDictionary,我設法更改了按鈕樣式,但沒有更改Progressbar的顏色
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}" />
目前這是不可能的。
使用SetResourceReference
方法將ProgressBarForeground
屬性設置為本地值,因此在Style
使用Setter
無效-本地值始終比來自Style
優先級高。
您可以嘗試覆蓋自定義詞典中的AccentColorBrush
資源,但這將無法正常工作,因為Mahapps中的當前主題代碼將掃描對話框中所有合並的資源詞典,並使用定義為“主題”的特殊資源替換該資源。強調顏色”。
有關詳細信息,請參見ThemeManager
源代碼。
您只有兩種選擇:
ProgressDialog
的進度條顏色
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.