Click here to Skip to main content
15,882,163 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have a DataGrid that I'm AutoGenerating the columns.
I want to specify a ToolTip on a range of the columns, (skipping the first one, and last 4).
I'm thinking I should be able to do this with the DataGridColumn.CellStyle.
However, I want to override this on rows with errors so the ToolTip explains the row error.
I already have the Row error styling:
XML
<DataGrid.RowStyle>
  <Style TargetType="DataGridRow">
    <Style.Triggers>
      <DataTrigger Binding="{Binding Path=Row.HasErrors}"
                   Value="True">
        <Setter Property="ToolTip"
                Value="{Binding Path=Row.RowError}" />
        <Setter Property="Foreground"
                Value="White" />
        <Setter Property="Background"
                Value="Red" />
      </DataTrigger>
    </Style.Triggers>
  </Style>
</DataGrid.RowStyle>

Can I add the DataGridColumn.CellStyle but still have the DataGrid.RowStyle take precedence?
Is there a better way to accomplish this?

[Edit: MTH]
It appears the DataGridColumn.CellStyle supercedes the DataGrid.RowStyle :(
[/Edit]
Posted
Updated 5-Feb-14 9:14am
v2

1 solution

It overwrite the style because a Cell its always more specific than a Row or Column. It is designed that way in the framewor. The quickest solution ican think is to put some lind of datatrigger in the cell style that detects any of the changes on the row like the style or an especific property
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900