Link to home
Create AccountLog in
Avatar of Bill
BillFlag for United States of America

asked on

DataGridView vs DataGrid in a .net core 3.1 WPF application

I am working on a desktop application using C#, WPF, and .net core 3.1. I was reading on Microsoft's website that DataGrid was being deprecated and should be replaced with DataGridView in .net core 3.1 applications. The issue I am having is that it doesn't seem to actually be supported or at least according to Visual Studio 2019. First, the DataGrid tool still exists in the toolbox while DataGridView does not. In addition, even if I manually type the DataGridView code in VS2019, the code is shown as invalid code. I was looking online and have been having issues finding any info on this so I am guessing I am doing something wrong.

My question is what should I be using, DataGrid of DataGridView? Being it is a new application I would have preferred to use the most up to data version (DataGridView) so my code doesn't break in a year, but if I have to still use DataGrid, I will.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

You should use the DataGridView. The DataGrid is depractated, and the DataGridView replaces the DataGrid control (and also adds some features).

In My VS 2019, using Framework 3.5, the only one I see is the DataGridView:

User generated image
If you don't see that, try rebuilding your toolbox.

Here's a list of differences between the DataGrid and the DataGridView:
https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/differences-between-the-windows-forms-datagridview-and-datagrid-controls
Avatar of Bill

ASKER

You are using Framework 3.5, I am using Core 3.1. I was reading online that the Framework is being deprecated as well. That while they are updating it right now it is end of life and will probably only get security patches in the future.
This tutorial : https://gunnarpeipman.com/datagridview-dotnet-core-31/
shows how to add DGV on Win Forms using .net Core 3.1...probably it should be helpful
Avatar of Bill

ASKER

I did read that but it seems like they are programming around DataGridView being missing in core. I may just use DataGrid for now and update the code later when it is officially supported. I believe a new update is due in not too long so DataGrid can work as a placeholder.

I just thought perhaps I was missing something as I tend to do.
ASKER CERTIFIED SOLUTION
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer