WPF DataGrid slow? Virtualizing rows is not enough
Your WPF DataGrid stutters with a lot of data, and you have already turned on everything that says "virtualization". Virtualizing rows is a solved problem. The real question is what happens with the columns, with layout, and in every single frame. This article gives you the fixes that help inside WPF, then describes the standard we build ArionUI to: Total Virtualization.
Why a virtualized DataGrid can still be slow
The DataGrid has row virtualization and container recycling on by default, so only rows in view get elements. Those rows are still small trees of elements: a DataGridRow, a DataGridCell per column, and a TextBlock with a binding in each text cell. Styling, binding, measure and arrange for them all run on the UI thread, which also handles your clicks and keystrokes.
Columns get less help. EnableColumnVirtualization exists, but it is off by default, so a wide table can realize every cell of each visible row, including those far off to the right.
What helps inside WPF
Check these first. They cost little, and for a modest table they may be all you need.
- Give the grid a bounded height. In a
StackPanel, aScrollVieweror a row withHeight="Auto"the grid is measured without a height limit, which commonly means it realizes far more rows than it shows. If the window freezes on load, look here first. - Keep virtualization on.
CanContentScroll="False"andIsVirtualizing="False"are on Microsoft's list of conditions that disable it. For grouped data, setVirtualizingPanel.IsVirtualizingWhenGrouping="True"; it defaults tofalse. - Turn on column virtualization with
EnableColumnVirtualization="True", and prefer fixed column widths, sinceAutocolumns can keep re-measuring as content scrolls in. - Keep cells lean. Prefer text columns to template columns and simplify the templates.
- Change data in place. Microsoft recommends an
ObservableCollection<T>over assigning a new list toItemsSource, which regenerates the items.
What these settings leave in place: each visible cell is still a set of elements on the UI thread. A sort or filter through a ListCollectionView still goes through the items on the calling thread. And "no WPF controls offer built-in support for data virtualization", in Microsoft's words.
Total Virtualization
Virtualizing rows is something any serious grid does, and the WPF DataGrid can virtualize columns too when you switch it on. But a grid built from WPF elements per cell carries the cost of that model for every cell it realizes: elements, bindings, layout. Scrolling sideways means realizing or recycling a column of elements across all visible rows. No setting escapes that, because the grid is built on that model.
ArionUI has no per-cell elements at all. This is a different approach, not a better setting. We call the standard behind it Total Virtualization:
Row and column counts do not decide how much a frame lays out and draws. The visible area does.
- In every direction. Each frame works out one window of rows and columns from the scroll position, both axes in the same calculation. It is on by design, with nothing to switch on.
- Layout included. There is no element per row or per cell to create, recycle or measure. Cells and headers outside the window do not get laid out.
- Drawing included. Only the cells in the window are drawn. A scroll reuses what it can and draws what newly came into view, and a hover or a changed value repaints what it affected.
The grid does keep a list of column widths, and it reads that list for bookkeeping, such as finding where the window starts. That is arithmetic over numbers, not a cell laid out or a string drawn, and a change of layout, such as a resized column, solves the widths again. A wide table costs that bookkeeping, not cells it does not show.
Built for the GPU
ArionUI clearly bets on the GPU, and Total Virtualization is designed around it. Plain table cells (backgrounds, value scales and text) go to the GPU in one instanced draw call from ArionUI's own shader program. On WPF, Skia draws through ANGLE on Direct3D 11 on the grid's own render thread, so drawing does not wait on the thread that handles your input.
Everything else is for emergencies and special cases such as a remote session without a GPU, and is not our focus. In such a case the WPF host keeps drawing through ANGLE, which can land on a software rasterizer, while the Avalonia host has a CPU path that repaints only the newly exposed strip. The window of rows and columns is the same, and RendererName tells you which adapter drew.
Total Virtualization on WPF
The ArionUI data grid comes to WPF as ArionGrid, a FrameworkElement you can put in any panel. On Windows it presents its frames itself, on a DirectComposition visual over the window. WPF content cannot be drawn over it (airspace), popups can; see Hosting and rendering.
dotnet add package ArionUI.Rendering.Wpf --prereleaseusing ArionUI.Core; // ListItemsSource
using ArionUI.Presentation; // GridView, Column, TypedColumn, ArionTheme
using ArionUI.Rendering.Wpf; // ArionGrid for WPF
public sealed record Order(int Id, string Customer, double Amount);
public partial class MainWindow : Window
{
public MainWindow(IReadOnlyList<Order> orders) // a million rows, or ten
{
InitializeComponent();
var view = new GridView<Order>(
[
TypedColumn.Number<Order>("Id", o => o.Id, format: "0").WithKey("id").WithWidth(80),
Column.Text<Order>("Customer", o => o.Customer).WithKey("customer").WithWidth(180),
TypedColumn.Number<Order>("Amount", o => o.Amount, format: "N2").WithKey("amount"),
],
new ListItemsSource<Order>(orders), // wraps the list, does not copy it
rowHeight: 24)
.AsDataGrid();
Content = new ArionGrid(view) { VisualTheme = ArionTheme.Light() };
}
}Columns are declared in code on a view. A view model can expose the view, and XAML binds it to MainView. For rows that are not in memory, VirtualItemsSource and RemoteItemsSource fetch pages in the background, and the second lets the server sort and filter.
What was measured
We measured the WPF host at three sizes, from a small table up to a million columns by a hundred million rows. The window was maximized, and the script scrolled vertically and horizontally at the left edge, the middle and the far right.
WPF host, ArionGrid | 20 columns × 1,000 rows | 20,000 × 1,000,000 | 1,000,000 × 100,000,000 |
|---|---|---|---|
| Frame cost, scrolling vertically (median) | 0.86 ms | 1.04 ms | 1.02 ms |
| Frame cost, scrolling horizontally at the far right (median) | (too narrow to scroll far) | 1.00 ms | 1.00 ms |
| Every frame on time at 60 Hz (median interval) | 16.6 ms | 16.5 ms | 16.6 ms |
| Time to first picture | 1.0 s | 0.7 s | 5.4 s |
| Managed memory | 35 MB | 77 MB | 1.84 GB |
Median of the best of three runs. Intel laptop GPU (i7-11800H, UHD Graphics) through ANGLE on Direct3D 11, grid 1920 × 1129, 60 Hz display, column width 100, computed read-only data, Release build. Measured on 31 October 2026 on 0.1.0-preview.2.
From twenty thousand cells to a hundred trillion, the cost of a frame stays at about a millisecond, and it does not depend on how far to the right you have scrolled. That is Total Virtualization in numbers. What does grow with the column count is setting the columns up: a million column definitions take about five seconds to build and close to two gigabytes of memory, once, before the first picture. Scrolling is not where that cost lands. We have not measured a side-by-side with the WPF DataGrid. FrameRendered lets you measure your own screen in a Release build:
var grid = new ArionGrid(view);
grid.FrameRendered += stats => Debug.WriteLine($"{stats.FrameMs:0.00} ms, {stats.DrawnSlots} rows drawn");Data work is separate
Total Virtualization is about the frame. Work on the data itself is a different matter: sorting and filtering visit the rows when the query changes, once and not per frame, reordering indexes without copying your items. Auto-size measures the text of the column. Performance lists what grows with your data and what stays in your hands, such as keeping column code cheap.
What to know before you try it
- A preview. ArionUI is at
0.1.0-preview.2. The API still moves, and it is not yet recommended for production. - .NET 10. The WPF host targets
net10.0-windows. An application on .NET Framework has to move to .NET first. - Column code runs on the render thread. On WPF, text getters and style predicates run there for the cells in view, so they must be cheap and must not read UI-thread state.
- No
DataTemplatein cells. Cells are drawn from ArionUI's own cell model, so existing cell templates have to be rewritten. - Some features are Pro modules. Grouping, pivot, charts and export are separate packages, free during the preview, also commercially.
Where to start
Try the WPF settings above first, since one of them may solve your problem. If you want a grid where the row and column counts stop deciding what a frame does, start with one screen: Install and first grid shows the setup. If the grid is part of an older application, Modernise your WinForms or WPF app describes how to replace it piece by piece.