MyToolkit
MyToolkit copied to clipboard
Column Width not uniform - Support Auto column width in DataGrid
Tried using the CellTemplate in the DataGrid. Some rows of data resulted in a width longer than others. Unfortunately the header nor the other rows adjusted their widths in the same column to be the same. Is there a way to set this up so the data in the same column has the same width for every row? If not, it wou
Did you use 'auto' as column width? That's not possible in this implementation. You should use '', '2', '3*' etc for relative columnwidths or '100', '200', etc for absolute column widths (in pixels).
I did use Auto - ok excellent, I'll try that out and respond with my findings - thank you!
Ok cool - I tried it and it works as designed. Unfortunately I've really been looking for the "Auto" implementation somewhere combined with a custom CellTemplate, and just haven't been able to find it yet. Any plans on supporting Auto in the future, or know of an implementation out there? I don't really even care if it is a DataGrid or not - I just need the ability to list out items where all the columns share a max width value in UWP apps.
Yeah, I was looking for an auto-width solution as well, but I couldn't find it. I don't know why it's implemented like this. They could have used a multi-row gridview, but I'm just a newby and not one of the developers of MyToolkit, so I am sure that Rico and his fellow programmers had a good reason to implement it as it is :)
However, if you don't need a dynamic number of rows you could just use a normal GridView.
Yeah, I need a dynamic number of rows. Right now I'm implementing a Grid, and within the grid, each column has a list view with listviewitems having a constant height. it isn't perfect, but it gets the job done.
Hi everyone.
I think the main problem with Auto is that the width cannot be calculated without rendering all rows, and this would be a performance killer. This is why only star and fixed with is supported. The DataGrid is very old (originally implemented for Windows 8 Preview) and was designed just for read-only access.
To support more scenarios (edit, auto-column, dynamic columns, brushes, etc.) more work is needed. However I have many open-source projects and currently MyToolkit is not on top of my prio list because most requests are feature requests and not bugs...
If someone has the time to improve the DataGrid control, please submit PRs and I'll merge them if they do not break existing code. If I have the time, I will gladly look into improving the DataGrid as it is an important missing piece in UWP apps...