We help IT Professionals succeed at work.
Get Started

DataGridView vs DataGrid in a .net core 3.1 WPF application

613 Views
Last Modified: 2020-01-12
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.
Comment
Watch Question
Scott McDaniel (EE MVE )Infotrakker Software
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
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:

DataGridView toolbox
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

Author

Commented:
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.
John TsioumprisIT Supervisor
CERTIFIED EXPERT
Distinguished Expert 2020

Commented:
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

Author

Commented:
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.
IT Supervisor
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE