Skip to main content
A newer version of this page is available. .

How to: Apply Conditional Formatting

  • 2 minutes to read

This example demonstrates how to change the appearance of individual cells based on specific conditions using the Conditional Formatting feature in markup.

The image below shows the result.

ExampleHowToApplyCF

using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace ConditionalFormatting {
    public class ConditionalFormattingViewModel {
        public ConditionalFormattingViewModel() {
            Items = SaleOverviewDataGenerator.GenerateSales();
        }
        public SaleOverviewData[] Items { get; private set; }
    }
}