Hi,
I begin with XamDataGrid, and i do some fonctionnality easy.
But now i would like one think, i think easy but no.
i would like to change the border coler of cell when the Tag of cell content "comment".
i write this:
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="BorderComment">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Cell.Tag.ToString()}" Value="comment">
<Setter Property="BorderBrush" Value="Red"/>
<Setter Property="BorderThickness" Value="1,1,1,1"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
but it don't work.
i need some help,
thank for all
Nathalie
Your trigger's binding is off. The DataContext of a CellValuePresenter is the associated DataRecord, and you can't call ToString() in a binding expression. Here's the right way to do it...
<Style TargetType="{x:Type igDP:CellValuePresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=Cells[SomeFieldName].Tag}" Value="comment"> <Setter Property="BorderBrush" Value="Red"/> <Setter Property="BorderThickness" Value="1" /> </DataTrigger> </Style.Triggers></Style>
Josh
thanks josh.
but i have another question :)
your code it's ok for one Cell but now how do i for 24 Cells ?
thanks, for all
ncordeau said:your code it's ok for one Cell but now how do i for 24 Cells ?
What do you mean? What difference does the number of cells make?
your's code is code but all the row is modified , and i want one the cell with tag.
about your ask :
in fact i have a grid where the user can insert commentary in cell, and i write the commentary text in the cell's tooltip .
when the user insert a commentary it's for one cell at a time, but after i would modified the look off the grid , when cell are commentary i would like to make the border's color in red.
i used the tag of the cell for display easily the tootip on cell.
Qttx is a number
HrQttx is the datetime input of Qttx => hidden col
CommentQttx is the text of the commentary.=> hidden col
exemple of my grid :
<igDP:FieldLayout.Fields> <igDP:Field Name="Id" Visibility="Collapsed" /> <igDP:Field Name="Nom" Label="Contrat"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="70" CellMaxWidth="80"/> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Qtt1" Label="6-7h" > <igDP:Field.Settings> <igDP:FieldSettings CellWidth="60" CellMaxWidth="60" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="HrQtt1" Visibility="Collapsed" /> <igDP:Field Name="CommentQtt1" Visibility="Collapsed"/> <igDP:Field Name="Qtt2" Label="7-8h"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="60" CellMaxWidth="60"/> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="HrQtt2" Visibility="Collapsed" /> <igDP:Field Name="CommentQtt2" Visibility="Collapsed"/> <igDP:Field Name="Qtt3" Label="8-9h"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="60" CellMaxWidth="60"/> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="HrQtt3" Visibility="Collapsed" /> <igDP:Field Name="CommentQtt3" Visibility="Collapsed"/>
so i would display the border potentially for 24 * X Field , or minus.
thanks for all,
If you apply the Style listed above to a Field's FieldSettings.CellValuePresenterStyle property, then only cells in that column will display a red border. That will allow you to have a cell-by-cell border color to show where the comments are.
thanks josh
i sorry but i don't see where i put the style ?
thanks
thanks a lot
it's ok it's work very well :)
Read this help page for more info.