1
전역으로 정의 텍스트 블록 헤더 셀의 전경 속성을 재정의하는 방법을WPF는 : XAML에 전역으로 정의 텍스트 블록 그레이 색상의
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{StaticResource BR_SE_Gray}" />
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontFamily" Value="Arial Unicode MS"/>
<Style.Triggers>
<Trigger Property="controls:TextBlockService.IsTextTrimmed" Value="True">
<Setter Property="ToolTip" Value="{Binding Text, RelativeSource={RelativeSource Self}}"/>
</Trigger>
</Style.Triggers>
이 난에서 그리드 뷰 헤더 셀 블랙 색상을 원하는 아래에 언급 된 코드. 위 코드 블록에서 foreground 속성에 검정색을 원합니다. 전역 적으로 정의 된 텍스트 블록 색상은 회색입니다. 그것을 무시하고
<ContentControl x:Name="ContentPresenter"
Grid.Column="0"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
FontFamily="pack://application:,,,/Themes/#Arial Rounded MT Bold"
FontWeight="Bold"
Foreground="{TemplateBinding Foreground}"
IsTabStop="{TemplateBinding IsTabStop}">
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="FontSize" Value="8" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontFamily" Value="pack://application:,,,/Themes/#Arial Rounded MT Bold" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
</Style>
</ContentControl.Style>
\ 대신 전경 =의 예를 원하는 값 "{TemplateBinding 전경을}"로 설정 - 스타일
inherit other properties set in base style
는당신이 스타일을 위해
BasedOn
을 설정해야합니다 그래서 직접 포어 그라운드 = "블랙" – Nitin