# spreadsheet-cell-customization

> SfSpreadsheet with custom cell styling and conditional formatting templates.

**Framework:** wpf  **Component:** Spreadsheet  **Variant:** cell-customization

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/wpf/spreadsheet-cell-customization.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.SfSpreadsheet.WPF
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/spreadsheet-cell-customization/Spreadsheet.xaml

```xaml
<UserControl
    x:Class="SpreadsheetCellCustomization.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
    SnapsToDevicePixels="True">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Syncfusion.SfSpreadsheet.WPF;component/Spreadsheet/Themes/Generic.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <!-- The template that renders a task row with an expander arrow and a
                 status badge instead of the plain cell content. -->
            <DataTemplate x:Key="TaskCellTemplate">
                <Border Margin="4,2"
                        Padding="6,2"
                        Background="#EEF3FA"
                        BorderBrush="#C7D3E3"
                        BorderThickness="1"
                        CornerRadius="3">
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                        <TextBlock Margin="0,0,8,0"
                                   VerticalAlignment="Center"
                                   FontWeight="Bold"
                                   Foreground="#1F2933"
                                   Text="{Binding CellValue}" />
                        <Border Padding="6,1"
                                Background="#D6E4F7"
                                CornerRadius="7">
                            <TextBlock FontSize="10"
                                       Foreground="#1F4E79"
                                       Text="CUSTOM" />
                        </Border>
                    </StackPanel>
                </Border>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!-- The header of the sample -->
        <Border Grid.Row="0"
                Padding="12,8"
                Background="#F3F6FA"
                BorderBrush="#D5DCE4"
                BorderThickness="0,0,0,1">
            <StackPanel Orientation="Horizontal">
                <TextBlock x:Name="HeaderTextBlock" Foreground="#52606D" />
                <Button x:Name="applyTemplateButton"
                        Margin="12,0,0,0"
                        Padding="12,3"
                        Click="applyTemplateButton_Click"
                        Content="Apply Custom Template" />
            </StackPanel>
        </Border>

        <!-- The workbook whose task column uses the custom cell template -->
        <syncfusion:SfSpreadsheet x:Name="spreadsheet"
                                  Grid.Row="1"
                                  AllowExtendRowColumnCount="False"
                                  FormulaBarVisibility="Collapsed"
                                  WorkbookLoaded="spreadsheet_WorkbookLoaded" />
    </Grid>
</UserControl>

```
