mcpField
S
syncfusion-wpf-excel-like-grid

syncfusion-wpf-excel-like-grid

github.com/syncfusionDevelopment5128 installsUpdated 1w ago
Repository

About syncfusion-wpf-excel-like-grid

A guide to implementing Syncfusion GridControl for WPF developers. It covers table configuration, interaction, virtualization, formulas, and Excel import and export.

Key features

  1. 01Configure cell types and styles
  2. 02Manage rows, columns, and selection
  3. 03Calculate formulas and add functions
  4. 04Clipboard operations and undo/redo
  5. 05Import and export Excel files
  6. 06Load virtual data and tune performance

Use cases

  1. 01Add a grid to a WPF application
  2. 02Load large grid datasets on demand
  3. 03Build formula cells and editing behavior
  4. 04Import or export Excel workbooks

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/syncfusion/wpf-ui-components-skills --skill syncfusion-wpf-excel-like-grid

After installing, type/syncfusion-wpf-excel-like-gridin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
advanced-features.md
appearance-and-styling.md
cell-types.md
editing-clipboard-undo.md
excel-import-export.md
formula-cells.md
getting-started.md
interactive-features.md
managing-rows-and-columns.md
performance-virtualization.md
selection-and-events.md

Details

From the project README

Implementing Syncfusion WPF GridControl

The Syncfusion WPF GridControl is a high-performance, cell-oriented grid that functions as a flexible tabular display engine. It makes no assumptions about data structure, supports virtual (on-demand) data loading via QueryCellInfo, and provides Excel-like behaviors including formulas, import/export, clipboard operations, covered cells, and 20+ built-in cell types.

When to Use This Skill

  • Adding a GridControl to a WPF application (XAML or code-behind)
  • Populating cells via direct assignment or the virtual QueryCellInfo event
  • Configuring cell types (CheckBox, ComboBox, DateTimeEdit, FormulaCell, etc.)
  • Customizing cell appearance (background, font, borders, data formats)
  • Managing rows and columns (insert, remove, move, freeze, hide)
  • Clipboard, undo/redo, and editing behavior
  • Interactive features: drag-drop columns, cell drag-drop, resizing
  • Formula cell support and the built-in formula library
  • Exporting grid data to Excel; importing Excel workbooks into the grid
  • Selection modes, events, and virtual mode patterns
  • Performance tuning, virtualization, covered ranges, zooming
  • Advanced features: comments, tooltips, printing, serialization, autofit

Documentation and Navigation Guide

Getting Started

📄 Read: references/getting-started.md

  • Required assembly references
  • Adding GridControl via designer or programmatically
  • Setting RowCount and ColumnCount
  • Populating data by loop vs. QueryCellInfo virtual event
  • Minimal working example
Cell Types

📄 Read: references/cell-types.md

  • 20+ built-in cell types: Header, Static, CheckBox, Button, Image, ComboBox, DropDownList, DateTimeEdit, IntegerEdit, DoubleEdit, CurrencyEdit, PercentEdit, MaskEdit, UpDownEdit, RichText, DataBoundTemplate, NestedGrid (ScrollGrid)
  • Setting Style.CellType on individual cells or ranges
  • ComboBox with ChoiceList vs. ItemsSource
  • Custom cell types (CellModel + CellRenderer pattern)
Appearance and Styling

📄 Read: references/appearance-and-styling.md

  • GridStyleInfo class and style inheritance hierarchy
  • Volatile vs. render cell styles
  • Base styles (BaseStylesMap), TableStyle, RowStyles, ColumnStyles
  • Background (solid/gradient), Foreground, Font, text orientation, borders
  • Numeric and DateTime format strings; FormatProvider interface
Managing Rows and Columns

📄 Read: references/managing-rows-and-columns.md

  • Setting row/column counts and default sizes
  • Hiding and unhiding rows/columns (SetHidden)
  • Freezing rows/columns; footer and header rows/columns
  • Inserting, moving, and removing rows/columns at runtime
  • Resize behavior and disabling resize controllers
Editing, Clipboard, and Undo/Redo

📄 Read: references/editing-clipboard-undo.md

  • CopyPasteOption flags (CopyText, CopyCellData, PasteCell, CutCell, XmlCopyPaste)
  • TextDataExchange for custom delimiters and buffer-based operations
  • Clipboard events and IGridCopyPaste custom implementation
  • CommandStack: Undo/Redo, BeginTrans, CommitTrans, Rollback
  • Creating derived commands for extended undo/redo
Interactive Features

📄 Read: references/interactive-features.md

  • Column drag-drop (AllowDragColumns)
  • Excel-like cell drag-drop (AllowDragDrop, DataObjectConsumerOptions)
  • Runtime row/column resizing and disabling resize controllers
  • Hide/unhide rows and columns visually (HiddenBorderBrush, SetHidden)
Formula Cells

📄 Read: references/formula-cells.md

  • Enabling FormulaCell type for individual cells or the entire grid
  • Built-in formula library (150+ functions: Sum, Avg, Sqrt, Pow, Cos, Sin, etc.)
  • Arithmetic operators and calculation precedence
  • Cross-cell references (A1 notation), named ranges
  • Adding custom formula functions to the library
Excel Import and Export

📄 Read: references/excel-import-export.md

  • Required assemblies (Syncfusion.XlsIO, Syncfusion.GridConverter.Wpf)
  • Exporting entire or selected grid content to .xls / .xlsx
  • Importing Excel workbooks: styles, formulas, conditional formatting, freeze panes, hyperlinks, comments
  • Virtualized import for large workbooks
Selection and Events

📄 Read: references/selection-and-events.md

  • Selection modes: cell, row, column (AllowSelection flags)
  • QueryCellInfo event pattern for virtual data loading
  • PrepareRenderCell for view-specific overrides
  • Common grid events: CommitCellInfo, CurrentCellActivated, clipboard events, RowsInserted, ColumnsMoved, ResizingRows, etc.
  • Working with GridRangeInfo and SelectedRanges
Performance and Virtualization

📄 Read: references/performance-virtualization.md

  • Virtual mode fundamentals and QueryCellInfo best practices
  • Covered ranges (CoveredCells) and floating cells
  • Zooming the grid
  • High-frequency update patterns
Advanced Features

📄 Read: references/advanced-features.md

  • Cell comments, input-message tips, and tooltips
  • Cell layout customization (covered cells, merged ranges, autofit)
  • Printing grid content
  • Serialization: saving and loading grid state
  • Autofit rows and columns to content

Quick Start Example

   1. Add assemblies: 
      Syncfusion.Grid.Wpf
      Syncfusion.GridCommon.Wpf,
      Syncfusion.Linq.Base, 
      Syncfusion.Shared.Wpf

  // 2. XAML — place GridControl inside a ScrollViewer
<ScrollViewer>
     <syncfusion:GridControl x:Name="gridControl" />
</ScrollViewer>

// 3. Code-behind: set size and populate
gridControl.Model.RowCount = 100;
gridControl.Model.ColumnCount = 10;

// Option A — direct assignment
for (int i = 0; i < 100; i++)
    for (int j = 0; j < 10; j++)
        gridControl.Model[i, j].CellValue = $"{i}/{j}";

// Option B — virtual mode (preferred for large data)
gridControl.QueryCellInfo += (s, e) =>
{
    if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex > 0)
        e.Style.CellValue = $"{e.Cell.RowIndex}/{e.Cell.ColumnIndex}";
};

Common Patterns

Apply a Cell Type to a Range
// Set an entire column to CheckBox
for (int i = 1; i <= gridControl.Model.RowCount; i++)
    gridControl.Model[i, 3].CellType = "CheckBox";
Alternate Row Colors via PrepareRenderCell
gridControl.PrepareRenderCell += (s, e) =>
{
    if (e.Cell.RowIndex > 0 && e.Cell.RowIndex % 2 == 0)
        e.Style.Background = Brushes.LightSkyBlue;
};
Freeze Header and Enable Formula Cells
gridControl.Model.FrozenRows = 1;
gridControl.Model.HeaderRows = 1;
gridControl.BaseStylesMap["Standard"].StyleInfo.CellType = "FormulaCell";
Export to Excel
gridControl.Model.ExportToExcel(@"Output.xlsx", ExcelVersion.Excel2007);

Key Style Properties

PropertyPurpose
Model[r, c].CellTypeSets built-in or custom cell type string
Model[r, c].CellValueData value stored in the cell
Model[r, c].BackgroundCell background brush
Model[r, c].ForegroundCell text color
Model[r, c].Font.FontSizeCell font size
Model[r, c].BordersIndividual border pens (Top/Bottom/Left/Right)
Model[r, c].FormatFormat string (e.g., "C", "0.00", "d")
Model.RowHeights[r]Row height in device-independent units
Model.ColumnWidths[c]Column width
Model.FrozenRowsNumber of rows frozen at top
Model.FrozenColumnsNumber of columns frozen at left

Comments

Markdown supported