In SfDataGrid, you can apply the style for every cell in a particular column based on CellValues. You can customize the FontWeight of the cells in a particular column, based on its cell content in two ways.
Customize Style using Converters You can customize the FontWeight of GridCell based on its data, by customizing its Style and Writing Converter for FontWeight property that converts the FontWeight based on bound data. The customized style can be set to SfDataGrid.CellStyle or GridColumn.CellStyle property based on your requirement. XAML The following code example demonstrates the ChangeFontWeight Converter Class that returns the FontWeight of the text based on cell value. C#
CellStyleSelector You can customize the FontWeight of GridCell based on its data, by customizing its style and writing the StyleSelector for FontWeight property that converts the FontWeight based on bound data. The customized style can be set to SfDataGrid.CellStyleSelector or GridColumn.CellStyleSelector property based on your requirement. XAML The following code example demonstrates how to write the style for FontWeight property of GridCell in App.Xaml. XAML The appropriate style is applied for a particular column depending on the row data in SelectStyle method of the StyleSelector Class. The following code example describes the StockCellStyleSelector class that returns the style based on cell value. C#
The following screenshot shows changing FontWeight for a particular column based on CellValue.
Figure 1: Changing FontWeight using CellValue
Sample Links:
|
This page will automatically be redirected to the sign-in page in 10 seconds.