Mejor DataGrid para WPF: ¿Integrado vs. Xceed?
He estado ahí. Probablemente tú también. Así que hablemos de qué una WPF DataGrid realmente necesita hacer en una aplicación real, donde el control incorporado se queda corto, y cómo se ven las alternativas.
¿Qué necesita hacer una DataGrid de WPF?
Suena como una pregunta sencilla, ¿verdad? Mostrar filas y columnas. Pero piensen en lo que los usuarios realmente esperan de una Rejilla de WPF estos días
Quieren hacer clic en el encabezado de una columna y que ordene. Arrastrar columnas debería funcionar sin problemas. Además, esperan filtrado, agrupación por categoría, y quizás incluso expandir una fila para ver datos relacionados debajo. No debería congelarse al cargar 50.000 filas. Y, sinceramente, necesita parecer que pertenece a una aplicación moderna de Windows, no a algo de 2008.
El integrado System.Windows.Controls.DataGrid maneja algo de esto. La ordenación básica funciona. Puedes enlazar a una colección. Pero ahí es donde terminan las buenas noticias.
Donde el DataGrid integrado de WPF se queda corto
No quiero criticar demasiado el control integrado; está bien para lo que es. Sin embargo, esto es lo que te encontrarás bastante rápido:
- El rendimiento se degrada con datos grandes. Intenta cargar unas decenas de miles de filas sin la virtualización adecuada. La interfaz de usuario se bloquea, el desplazamiento se vuelve entrecortado y tus usuarios empiezan a preguntarse si la aplicación se ha colgado. La cuadrícula incorporada tiene algo de virtualización, pero es básica: sin carga asíncrona desde fuentes remotas, sin caché preventiva. Si tus datos residen en una base de datos, estás solo.
- Maestro-detalle no existe. ¿Necesitas mostrar pedidos con sus artículos? ¿Departamentos con empleados? La cuadrícula integrada no soporta esto en absoluto. Terminarás construyendo una solución personalizada con cuadrículas anidadas (lo cual... no es divertido) o recurriendo a un control de terceros.
- La agrupación es limitada. Técnicamente puedes agrupar, pero ¿agrupación multinivel con resúmenes? ¿Encabezados de grupo personalizados? Eso es mucho trabajo manual para algo que debería ser sencillo.
- La temática parece estancada en 2010. La apariencia predeterminada está desactualizada. Lograr que coincida con la estética de Windows 10/11 requiere una sorprendente cantidad de personalización XAML. Y si tu diseñador pide Material Design, buena suerte.
- No exportar, no imprimir. No hay exportación a Excel, ni CSV, ni soporte de impresión integrado. Como resultado, necesitarás crearlo tú mismo o añadir otra biblioteca.
¿Te suena algo de esto?
¿Por qué la mayoría termina usando Xceed DataGrid para WPF?
Seré directo: hay varias opciones de terceros DataGrid WPF opciones disponibles. He probado algunas a lo largo de los años. La que se ha mantenido para los usuarios es nuestra Xceed DataGrid para WPF.
¿Por qué? En parte porque lleva más de 13 años en el mercado y tiene algo así como 185 funciones (su afirmación, no la mía). Más importante aún, cuando lo incluí en un proyecto, las cosas simplemente funcionaron sin mucha complicación. Tu experiencia puede variar, pero esa ha sido la mía.
Déjame mostrarte las características con código que funcione para que puedas juzgarlo tú mismo.
Primeros pasos con el Xceed WPF DataGrid
Primero, toma el Paquete NuGet:
Install-Package Xceed.Products.Wpf.DataGrid.FullLuego configura tu clave de licencia en App.xaml.cs (recibes una clave de prueba al descargar, o una permanente con una licencia):
protected override void OnStartup(StartupEventArgs e)
{
Xceed.Wpf.DataGrid.Licenser.LicenseKey = "YOUR-LICENSE-KEY";
base.OnStartup(e);
}Y eso es básicamente todo para la configuración. (Xceed tiene más tutorial detallado para principiantes (si desea la imagen completa). Agregue el espacio de nombres a su XAML y listo:
<Window xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
<xcdg:DataGridControl ItemsSource="{Binding Products}">
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="Name" Title="Product Name" />
<xcdg:Column FieldName="Price" Title="Price" />
<xcdg:Column FieldName="Category" Title="Category" />
<xcdg:Column FieldName="InStock" Title="In Stock" />
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>
</Window>Eso te da un completamente funcional DataGrid en WPF — ordenamiento, filtrado, edición, todo incorporado. No se necesita configuración adicional para lo básico.
La vista Tableflow para una cuadrícula WPF moderna
La vista de tabla predeterminada está bien, pero Xceed tiene esto llamado Tableflow eso es honestamente difícil de revertir una vez que lo has usado. Es una vista de tabla animada con desplazamiento inercial fluido, encabezados de grupo fijos y reordenamiento de columnas mediante arrastrar y soltar.
Cambiar a él es una propiedad:
<xcdg:DataGridControl ItemsSource="{Binding Employees}">
<xcdg:DataGridControl.View>
<xcdg:TableflowView AllowColumnChooser="True"
IsAlternatingRowStyleEnabled="True" />
</xcdg:DataGridControl.View>
</xcdg:DataGridControl>En AllowColumnChooser la propiedad agrega un pequeño botón que permite a los usuarios elegir qué columnas quieren ver. IsAlternatingRowStyleEnabled hace lo que uno esperaría: colores alternos en las filas para facilitar la lectura. Pequeñas cosas, pero marcan la diferencia.
También hay otras vistas: TableView (la cuadrícula plana clásica), TreeGridflow para datos de árbol jerárquico e incluso una vista de tarjetas 3D si te sientes aventurero. Sin embargo, yo me quedo principalmente con Tableflow.
Agrupación de DataGrid en WPF que realmente funciona
Esta es una de esas cosas en las que el integrado WPF DataGrid técnicamente soporta la agrupación, pero te hace trabajar demasiado para cualquier cosa que vaya más allá de lo básico. Con Xceed, usas su DataGridCollectionView y simplemente… funciona:
var collectionView = new DataGridCollectionView(employees);
collectionView.GroupDescriptions.Add(
new DataGridGroupDescription("Department"));
groupingGrid.ItemsSource = collectionView;Esto te da empleados agrupados por departamento, con encabezados de grupo colapsables. Si quieres agrupaciones multinivel, solo agrega otra DataGridGroupDescription. De igual manera, si necesitas resúmenes (conteo, suma, promedio) en las cabeceras de grupo, Xceed también lo soporta. Hay una tutorial más detallado sobre cómo agrupar y ordenar Si quieres ver más ejemplos.
El lado XAML permanece limpio:
<xcdg:DataGridControl x:Name="groupingGrid">
<xcdg:DataGridControl.View>
<xcdg:TableflowView IsAlternatingRowStyleEnabled="True" />
</xcdg:DataGridControl.View>
</xcdg:DataGridControl>Filtrado de su DataGrid de WPF (estilo Excel)
Una cosa que siempre me molestó del control integrado es todo el trabajo que hay que hacer para obtener un filtrado decente. Xceed tiene autofiltrado incorporado: esos filtros desplegables estilo Excel en los encabezados de columna. Lo habilitas en el DataGridCollectionViewSource:
<Window.Resources>
<xcdg:DataGridCollectionViewSource x:Key="cvs_products"
Source="{Binding Products}"
AutoFilterMode="And" />
</Window.Resources>
<xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource cvs_products}}">
<xcdg:DataGridControl.View>
<xcdg:TableflowView />
</xcdg:DataGridControl.View>
</xcdg:DataGridControl>Configurar AutoFilterMode a "And" (todos los criterios de filtro deben coincidir) o "Or" (cualquier criterio coincide), y obtienes menús desplegables de filtro en cada columna automáticamente. También puedes desactivarlo para columnas específicas con AllowAutoFilter="False" si algunas columnas no tienen sentido para filtrar. El tutorial de filtrado cubre escenarios avanzados como valores distintos personalizados y la combinación de enfoques de filtrado.
Maestro-detalle en el DataGrid de WPF (el complicado)
Okay, admito que este me tomó un poco para descifrar. Maestro-detalle en Xceed funciona mejor cuando le das una DataSet con DataRelation objetos — piénsalo como definir una relación de clave foránea que la cuadrícula pueda entender y expandir.
Esta es la configuración del lado del C#. El código es un poco más extenso que en los otros ejemplos, pero ten paciencia:
var dataSet = new DataSet();
// Master table: Orders
var ordersTable = new DataTable("Orders");
ordersTable.Columns.Add("OrderId", typeof(int));
ordersTable.Columns.Add("Customer", typeof(string));
ordersTable.Columns.Add("OrderDate", typeof(DateTime));
ordersTable.Columns.Add("Total", typeof(decimal));
ordersTable.PrimaryKey = new[] { ordersTable.Columns["OrderId"]! };
// Detail table: OrderDetails
var detailsTable = new DataTable("OrderDetails");
detailsTable.Columns.Add("DetailId", typeof(int));
detailsTable.Columns.Add("OrderId", typeof(int));
detailsTable.Columns.Add("Product", typeof(string));
detailsTable.Columns.Add("Quantity", typeof(int));
detailsTable.Columns.Add("UnitPrice", typeof(decimal));
dataSet.Tables.Add(ordersTable);
dataSet.Tables.Add(detailsTable);
// This is the key part — the DataRelation
dataSet.Relations.Add("OrderDetails",
ordersTable.Columns["OrderId"]!,
detailsTable.Columns["OrderId"]!);Lo importante aquí es que DataRelation nombre ("OrderDetails") necesita coincidir con lo que pones en tu XAML. DetailConfiguration. Luego lo envuelves en un DataGridCollectionView:
var collectionView = new DataGridCollectionView(ordersTable.DefaultView);
masterDetailGrid.ItemsSource = collectionView;Y el XAML:
<xcdg:DataGridControl x:Name="masterDetailGrid"
AutoCreateDetailConfigurations="True"
ReadOnly="True">
<xcdg:DataGridControl.View>
<xcdg:TableflowView />
</xcdg:DataGridControl.View>
<xcdg:DataGridControl.DetailConfigurations>
<xcdg:DetailConfiguration RelationName="OrderDetails"
Title="Order Details">
<xcdg:DetailConfiguration.Columns>
<xcdg:Column FieldName="OrderId" Visible="False" />
<xcdg:Column FieldName="DetailId" Visible="False" />
</xcdg:DetailConfiguration.Columns>
</xcdg:DetailConfiguration>
</xcdg:DataGridControl.DetailConfigurations>
</xcdg:DataGridControl>Un par de detalles que me encontré: AutoCreateDetailConfigurations predeterminado false, así que tú have para configurarlo True o no obtendrás botones de expansión y te preguntarás qué salió mal. Y la RelationName en el DetailConfiguration tiene que coincidir con el DataRelation nombre exactamente — distingue entre mayúsculas y minúsculas.
Sin embargo, una vez que funciona, es realmente agradable. Esencialmente, cada fila de pedido obtiene una flecha de expansión; haz clic en ella y verás los artículos de la línea en línea. Una barra de desplazamiento para todo, sin tonterías de cuadrícula anidada. documentación maestro-detalle tiene ejemplos adicionales si necesita jerarquías más profundas.
Soporte MVVM y enlace de datos
Si estás desarrollando en WPF, es probable que uses MVVM, y te estarás preguntando si la cuadrícula de Xceed se integra bien con él. Respuesta corta: sí, lo hace.
La cuadrícula se une a ItemsSource al igual que cualquier otro control de WPF, así que tu estándar ObservableCollection<T> y INotifyPropertyChanged los patrones funcionan como se esperaba. Aquí tienes una configuración típica de ViewModel:
public class ProductViewModel : INotifyPropertyChanged
{
public ObservableCollection<Product> Products { get; }
public ProductViewModel()
{
Products = new ObservableCollection<Product>(
LoadProductsFromDatabase());
}
public event PropertyChangedEventHandler? PropertyChanged;
}<xcdg:DataGridControl ItemsSource="{Binding Products}" />Nada inusual ahí. La cuadrícula capta los cambios de recolección automáticamente — agrega o elimina elementos de la ObservableCollection y las actualizaciones de la interfaz de usuario. De manera similar, los cambios en las propiedades de elementos individuales se propagan a través de INotifyPropertyChanged como era de esperar.
Además, la DataGridCollectionView y DataGridCollectionViewSource sigue los mismos patrones que los integrados de WPF CollectionView / CollectionViewSource, así que si ya estás familiarizado con ellas, te sentirás como en casa.
Xceed también expone propiedades de dependencia como SelectedItemsSource y CurrentItem para el enlace bidireccional — el Documentación de MVVM cubre esto en detalle.
Tematización y apariencia
Xceed ships with 18 themes. I’ve mostly been using the Windows 10 one because it fits naturally on modern Windows, but there’s also Aero, Windows 7, Windows 8, Zune (yes, Zune), Office 2007/2010 styles, and more.
Applying a theme in XAML:
<xcdg:DataGridControl ItemsSource="{Binding Products}">
<xcdg:DataGridControl.View>
<xcdg:TableflowView IsAlternatingRowStyleEnabled="True">
<xcdg:TableflowView.Theme>
<tp5:Windows10Theme />
</xcdg:TableflowView.Theme>
</xcdg:TableflowView>
</xcdg:DataGridControl.View>
</xcdg:DataGridControl>(You’ll need the namespace for the theme pack: xmlns:tp5="clr-namespace:Xceed.Wpf.DataGrid.ThemePack;assembly=Xceed.Wpf.DataGrid.ThemePack.5")
You can also switch themes at runtime in code-behind, which is handy if you want to let users pick their preferred look. Each theme is a separate assembly, so you only load the ones you actually use. Xceed also has a Paquete de temas Pro that styles all standard WPF controls to match, not just the grid.
Performance and virtualization
I haven’t talked about this enough yet, and it’s probably the single most important reason to look beyond the built-in Rejilla de WPF control. Xceed DataGrid has full UI virtualization (only visible rows get rendered), column virtualization (matters when you have wide grids), and — this is the big one — async data virtualization.
In practice, that means the grid can fetch data from a remote source in the background, cache it, and preemptively load nearby pages. As a result, your UI never freezes. The grid handles datasets with millions of rows, which is something the built-in WPF DataGrid simply can’t do without a lot of custom plumbing.
If you’re building anything that talks to a database or an API — honestly, any data source bigger than what fits comfortably in memory — this is the feature that matters most. There’s a practical walkthrough on renderizar 1 millón de filas sin congelar la interfaz de usuario si quieres ver los detalles.
What else is in the box?
Beyond the features above, there are some things I haven’t covered in detail but are still worth mentioning:
- Editing. The grid auto-selects editors based on data type — text boxes for strings, date pickers for dates, checkboxes for booleans, numeric editors for numbers. It supports
IDataErrorInfoyINotifyDataErrorInfopara validation. Masked input (phone numbers, SSNs) is built in too. - Export. Excel (XLSX), CSV, and clipboard copy are all included. No extra NuGet packages, no third-party libraries. Same goes for print preview and printing.
- .NET support. Works on .NET Framework 4.0+, .NET Core 3.0+, and all the way up to .NET 8. Whether you’re maintaining a legacy app or starting fresh, it’s compatible.
Built-in WPF DataGrid vs. Xceed: feature comparison
Here’s the side-by-side, since I know that’s what a lot of people are looking for:
| Característica | DataGrid WPF Integrado | Xceed DataGrid para WPF |
|---|---|---|
| Virtualización de UI | Básico | Completo (incluyendo datos agrupados) |
| Virtualización de datos asíncrona | No | Sí |
| Desplazamiento suave | No | Sí (inercial) |
| Maestro-Detalle | No | Sí (barra de desplazamiento única) |
| Agrupación Multinivel | Limitado | Completo con resúmenes |
| Auto-Filtering | No | Yes (Excel-style) |
| Temas integrados | 1 | 18 |
| Excel Export | No | Yes (XLSX + CSV) |
| Impresión | No | Sí |
| Vistas 3D | No | Sí |
| Editores enriquecidos | Básico | Suite completa |
| .NET 8 Support | Sí | Sí |
Pricing and licensing
Since people always ask — Xceed DataGrid for WPF is a commercial product. It’s not free, and it’s not open source. You can request a free 45-day trial to evaluate it, and licenses are per-developer (no runtime royalties). Pricing varies depending on whether you want just the DataGrid or the full Business Suite. Check the pricing page for current numbers.
If you’re looking for something free, the built-in DataGrid is obviously zero cost, and there are some open-source options on GitHub — though in my experience they tend to be much more limited in features and polish.
Choosing the right DataGrid for WPF
Look, the built-in DataGrid en WPF is not a bad control. For simple stuff, it gets the job done. On the other hand, if you’re building something that real users depend on — something with big datasets, hierarchical data, grouping, export needs, or just a look that doesn’t feel a decade old — you’re going to hit its limits fast.
Xceed DataGrid para WPF has been my go-to for these situations. Is it the only third-party grid out there? No. But the combination of Tableflow, master-detail, async virtualization, and the fact that it just works on .NET 8 without surprises — that’s why I keep reaching for it.
If you’re wrestling with the built-in grid or evaluating your options, it’s worth giving it a try. The NuGet package gets you up and running in about five minutes, and there are 28 solicitudes de ejemplo covering pretty much every feature if you want to explore further.
¿Listo para probar Xceed DataGrid para WPF?
Download the full-featured DataGrid and try it free for 45 days, no commitment.
Consíguelo ahora – prueba gratuita de 45 días
Instalar vía NuGet
Preguntas más frecuentes
Is there a free DataGrid for WPF?
Yes — WPF ships with a built-in System.Windows.Controls.DataGrid that’s completely free. It covers basic sorting, column binding, and simple editing. However, for anything more advanced (master-detail, async virtualization, Excel export, theming), you’ll likely need a commercial WPF DataGrid component like Xceed.
How do I improve WPF DataGrid performance with large datasets?
The built-in grid supports basic UI virtualization. However, for truly large datasets you need async data virtualization — loading data on demand from the source without freezing the UI. Xceed DataGrid for WPF is the only Rejilla de WPF that supports this natively. You can also improve performance by enabling column virtualization and using a TableflowView o TableView instead of card-based views.
Does the WPF DataGrid support MVVM?
El integrado DataGrid works with MVVM through standard ItemsSource binding, ObservableCollection<T>y INotifyPropertyChanged. Third-party grids like Xceed follow the same patterns — you bind to ItemsSource, and collection and property changes propagate automatically. Xceed’s DataGridCollectionViewSource also works as a XAML resource, similar to WPF’s built-in CollectionViewSource.
Can I export a WPF DataGrid to Excel?
Not with the built-in control — there’s no export functionality included. In contrast, Xceed DataGrid for WPF has built-in Excel (XLSX) and CSV export, plus clipboard copy support and print/print preview. No additional libraries needed.