xamDataGrid过滤器记录样式

时间:2011-08-02 16:17:51

标签: c# wpf xaml infragistics xamdatagrid

我正在尝试更改xamDataGrid中过滤器记录的背景颜色。

我按照Infragistics论坛的建议尝试<SolidColorBrush x:Key="{ComponentResourceKey {x:Type igDP:XamDataGrid}, AddRowBackground}" Color="Red"/>

<Style TargetType="{x:Type igDP:DataRecordPresenter}">
  <Style.Triggers>
    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsFilterRecord}" Value="True">
      <Setter Property="Background" Value="#363636" />
    </DataTrigger>
  </Style.Triggers>
</Style>

但它们都没有工作,我的滤镜行仍然是白色的。

有什么想法吗?

3 个答案:

答案 0 :(得分:1)

尝试

TargetType="{x:Type igDP:DataRecordCellArea}"

答案 1 :(得分:0)

背景颜色来自模板中使用AddRowBackground资源的边框。可以使用以下

设置此资源

<SolidColorBrush x:Key="{ComponentResourceKey {x:Type igDP:XamDataGrid}, AddRowBackground}" Color="#363636"/>

DataPresenterBrushKeys类: http://help.infragistics.com/NetAdvantage/WPF/Current/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v11.2~Infragistics.Windows.DataPresenter.DataPresenterBrushKeys.html

答案 2 :(得分:0)

我知道有点晚了,但我遇到了同样的问题。 我发现我正在设置DataRecordCellArea Background,它覆盖了AddRowBackground。

<Style TargetType="{x:Type igDp:DataRecordCellArea}">      
  <Setter Property="Background" Value="{DynamicResource DataGridBackgroundBrush}" />
</Style>

<SolidColorBrush x:Key="{ComponentResourceKey {x:Type igDp:XamDataGrid}, AddRowBackground}" Color="Red"/>

要修复我已注释掉DataRecordCellArea背景

<Style TargetType="{x:Type igDp:DataRecordCellArea}">      
      <!--<Setter Property="Background" Value="{DynamicResource DataGridBackgroundBrush}" />-->
<!-- other stters -->
    </Style>
<SolidColorBrush x:Key="{ComponentResourceKey {x:Type igDp:XamDataGrid}, AddRowBackground}" Color="Red"/>

现在滤镜行背景为红色