【发布时间】:2011-07-10 23:03:24
【问题描述】:
我有一个 ProgressbarStyle,我在其中将 TextBlock-Control 添加到网格“DeterminateRoot”。这个 TextBlock 应该显示一个状态文本,我在 CodeBehind 中手动更改它,这已经可以了。
这是我风格的一部分,我在标准 ProgressbarStyle 中进行了更改:
<Grid x:Name="DeterminateRoot" Margin="1"> <Rectangle x:Name="ProgressBarIndicator" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Left" Margin="{TemplateBinding BorderThickness}" RadiusY="1.5" RadiusX="1.5" StrokeThickness="0.5"/> <TextBlock x:Name="txtbStatusText" Text="5 of 20" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontWeight="Bold" FontFamily="Arial" FontSize="11"></TextBlock> </Grid>
我的问题是:如何在不更改进度条的标准颜色的情况下将 TextBlock-Text 的 Foregroundcolor 更改为黑色?因为,当我删除 Rectangle 的 Fill-Property (ProgressBarIndicator) 时,我可以更改 TextBlock 的 ForegroundColor,但我想保持 Progressbar 的标准外观!
提前感谢您的回答!
最好的问候 道吉
【问题讨论】:
标签: xaml silverlight-4.0 styles