How to Create DataGrid with .NET MAUI Preview 7?
Asked Answered
C

4

10

I'm working with a .NET MAUI Preview 7 project and I need to create a Table/Datagrid but I see that in the XAML file, there is no tag for "Table","DataGrid" or "DataView".

I found only "Grid" which is used to divide the form in rows and columns.

What should I use to create a table showing data (DataBinding)?

Thanks

Cutlery answered 20/8, 2021 at 8:40 Comment(0)
L
3

Assuming that you mean a grid control like Excel, then that is not something you will find in the box for .NET MAUI, not for the preview, but also not for the final version.

Depending on what you want to achieve you might want to reconsider how you are representing your data or consider getting pre-made controls from vendors like Telerik or SyncFusion.

Update: Reading this again I might've misunderstood your question, sorry about that. A control like that won't be available with .NET MAUI, but of course you can create a custom control if that's what you like. The Grid probably is a great starting point, but that will only provide the layout with read-only data. If you want to extend it beyond that you will have to gain knowledge about how to create custom controls for .NET MAUI

Lindeman answered 20/8, 2021 at 10:36 Comment(3)
Is there an ideological reason for this? If .NET MAUI is to support Windows and Mac desktop, that seems like a big omission.Graehme
There is not. I'm not saying there never will be, just not right now. Personally I think it is a too complex control to have in there directly. People have been asking for calendar controls, data grids and what not. Which I totally understand but those controls can become really complex, really fast. I think the better option for that is with third-party vendors. The other part is: we want the most common denominator. I don't think a grid will work on mobile, but then having it for only desktop feels weird. Time will tell :)Lindeman
I get that. Those controls can be terribly bloated. However HTML has a simple TABLE tag and I can make that content editable. And you're right, tabular data requires some effort/thought for mobile so it doesn't always make sense there. Thanks for the quick reply.Graehme
E
6

There is an implementation for DataGrid: https://enisn-projects.io/docs/en/uranium/latest/themes/material/components/DataGrid

Disclaimer: This implementation is done by me, but it's an open-source project and completely free. There is no benefit to me and it's not self-promotion.


Also a good alternative: https://github.com/akgulebubekir/Maui.DataGrid

Evidently answered 10/9, 2022 at 19:31 Comment(1)
Also there is another option here github.com/akgulebubekir/Maui.DataGridEvidently
L
3

Assuming that you mean a grid control like Excel, then that is not something you will find in the box for .NET MAUI, not for the preview, but also not for the final version.

Depending on what you want to achieve you might want to reconsider how you are representing your data or consider getting pre-made controls from vendors like Telerik or SyncFusion.

Update: Reading this again I might've misunderstood your question, sorry about that. A control like that won't be available with .NET MAUI, but of course you can create a custom control if that's what you like. The Grid probably is a great starting point, but that will only provide the layout with read-only data. If you want to extend it beyond that you will have to gain knowledge about how to create custom controls for .NET MAUI

Lindeman answered 20/8, 2021 at 10:36 Comment(3)
Is there an ideological reason for this? If .NET MAUI is to support Windows and Mac desktop, that seems like a big omission.Graehme
There is not. I'm not saying there never will be, just not right now. Personally I think it is a too complex control to have in there directly. People have been asking for calendar controls, data grids and what not. Which I totally understand but those controls can become really complex, really fast. I think the better option for that is with third-party vendors. The other part is: we want the most common denominator. I don't think a grid will work on mobile, but then having it for only desktop feels weird. Time will tell :)Lindeman
I get that. Those controls can be terribly bloated. However HTML has a simple TABLE tag and I can make that content editable. And you're right, tabular data requires some effort/thought for mobile so it doesn't always make sense there. Thanks for the quick reply.Graehme
U
2

Use Maui.DataGrid library on GitHub. Its simple and straightforward.

Upstream answered 31/10, 2022 at 9:55 Comment(0)
W
0

Building a complete datagrid with considerations for cell editing, column sorting, and data binding with virtualization in mind is a big task. You could just get one already written from GitHub or Nuget.

Of course, I would choose the FlexGrid from MESCIUS/ComponentOne.

On Nuget.org: C1.MAUI.Grid https://developer.mescius.com/componentone/maui-ui-controls/flexgrid-maui-datagrid

Whiney answered 27/6 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.