In SfDataGrid, you can customize the Cell/Row style based on the data in the following three ways,
You can customize the Cell/Row based on content by using CellStyleSelector/ RowStyleSelector, but it affects the performance while styling more number of columns or rows. Therefore, this is not a recommended way for styling the SfDataGrid for more number of columns or rows. You can use this StyleSelector according to your necessity.
To know more about the StyleSelector you can refer to the following links:
You can customize the Cell/Row based on content by using Style.Triggers, but compared to Binding Converter, the performance is low when styling more number of columns or rows in SfDataGrid.
To know more about the DataTriggers you can refer to the following links:
Customizing the properties in Style using Converters
In SfDataGrid, customizing properties in Style using Converter is the suggested way to customize the properties of Cell/Row, based on its content. As it provides improved performance compared to other two ways.
For Cell Style
In the following code example, the Background of the GridCell for a particular column is customized based on its content using Converters.
The following code example illustrates the CellStyleConverter for customizing the Cell style based on the Cell content.
The following screenshot displays the output of CellStyle in SfDataGrid.
Figure 1: CellStyle in SfDataGrid
For Row Style
In the following code example, the Background of the VirtualizingCellsControl is customized based on its content using Converters.
The following code example illustrates the RowStyleConverter for customizing the Cell/Row style.
The following screenshot displays the output of RowStyle in SfDataGrid.
Figure 2: RowStyle in SfDataGrid
Refer to the following sample links to customize the GridCell, based on the Converter to increase the performance of the SfDataGrid in WPF and Silverlight.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:||Product Version:|
or the page will be automatically redirected to sign-in page in 10 seconds.