DataGridView vs DataGrid in a .net core 3.1 WPF application

Aludaan
Aludaan used Ask the Experts™
on
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

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Scott McDaniel (EE MVE )Infotrakker Software
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 TsioumprisSoftware & Systems Engineer

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.
Software & Systems Engineer
Commented:
I think that the problem is not the support of DGV in core but the lack of support on the Designer....which is kind of natural
.NET Core essentially makes a huge leap...trying to "liberate" the GUI from code...so that it behaves as 2 separate things..in that concept is "logical" that the designer might always be a step back ... or two...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial