Change ForeColor of cell in codebehind
Hi folks,
I have this xaml:
<syncfusion:SfDataGrid x:Name="dgLevel1" Grid.Column="0" Grid.Row="1"
AutoGenerateColumns="True"
ColumnSizer="AutoWithLastColumnFill"
AutoGeneratingColumn="dgLevel1_AutoGeneratingColumn"/>
An this code behind:
private void dgLevel1_AutoGeneratingColumn(object sender, Syncfusion.UI.Xaml.Grid.AutoGeneratingColumnArgs e)
{
if (e.Column.MappingName == "Color")
{
...
}
else if (e.Column.MappingName == "Description")
{
...
}
}
Please can you provide code in code behind that change cell color (not header cell) of one cell based a mapped column? I need to change "Description" mapping forecolor based "color" mapping.
Cheers
I have this xaml:
<syncfusion:SfDataGrid x:Name="dgLevel1" Grid.Column="0" Grid.Row="1"
AutoGenerateColumns="True"
ColumnSizer="AutoWithLastColumnFill"
AutoGeneratingColumn="dgLevel1_AutoGeneratingColumn"/>
An this code behind:
private void dgLevel1_AutoGeneratingColumn(object sender, Syncfusion.UI.Xaml.Grid.AutoGeneratingColumnArgs e)
{
if (e.Column.MappingName == "Color")
{
...
}
else if (e.Column.MappingName == "Description")
{
...
}
}
Please can you provide code in code behind that change cell color (not header cell) of one cell based a mapped column? I need to change "Description" mapping forecolor based "color" mapping.
Cheers
SIGN IN To post a reply.
3 Replies
JG
Jai Ganesh S
Syncfusion Team
January 8, 2018 01:04 PM UTC
|
Hi Josep,
You can achieve your requirement to change the ForeGroundColor based on the cell value in using CellStyleSelector like below,
Sample:
|
Regards,
Jai Ganesh S
JO
josep
January 8, 2018 03:51 PM UTC
thanks. works
JG
Jai Ganesh S
Syncfusion Team
January 9, 2018 04:27 AM UTC
Hi Josep,
Thank you for the update.
Please let us know if you need further assistance on this.
Regards,
Jai Ganesh S
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
JO josep
- Jan 5, 2018 07:16 PM UTC
- Jan 9, 2018 04:27 AM UTC