We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change FontWeight for particular column based on Cell Value?

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.

  1. Customize Style using Converters.
  2. CellStyleSelector.

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#

Note: You can apply the style for a particular column by using GridColumn.CellStyle in SfDataGrid.

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#

Note: You can apply the style for a particular column by using GridColumn.CellStyleSelector in SfDataGrid.

The following screenshot shows changing FontWeight for a particular column based on CellValue.

 

F:\Farjana\F Drive\KB\Font Weight\2015-01-30_17-37-47.png

Figure 1: Changing FontWeight using CellValue

 

Sample Links:

WPF

WRT

SilverLight

UWP

Article ID: Published Date: Last Revised Date: Platform: Control:
6079 01/22/2016 01/22/2016 UWP SfDataGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon