Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to customize cell appearance based on custom logic

$
0
0

Cell template in WPF Spreadsheet allows you to change the visual presentation of cells. To assign a cell template, use the CellTemplate property of the SpreadsheetControl, as illustrated in the How to customize cell appearance using a cell template example.
The template is applied to all existing cells in the worksheet. However, you can have more than one template and implement custom logic to choose the desired template. This allows you to provide a different visual appearance for individual cells. To choose templates based on a custom logic:
1) Create a template selector class that derives from the System.Windows.Controls.DataTemplateSelector class and override the SelectTemplate method to return a template which meets the required condition.
2) Assign its instance to the CellTemplateSelector property.

This example uses template selector to display formulas above certain cells. If a cell does not a contain a formula, it displays a red marker that warns about missing formula.
The result is shown below:




Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>