-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: Modern WinUI DataGrid - Input Needed #1500
Comments
More viewmodes. Take a look at File Explorer and it's Icon views. The DataGrid should be able to show icons/items in a grid with grouping, as well as the headed rows and columns. I know this may not be possible, or out of scope - but it is an aspect of WinUI vs Win32 that isn't as easy as 1:1 - and a modern version of File Explorer, or the Common File Dialogs - may have need of such a control. This could be that control, not an internal custom control. |
My wishlist : to me a good datagrid includes all the following features by default. I'm borrowing some screenshots from the html world. Easy filter the whole page with preferred row count. Select / Deselect Visible Columns , Column Sorting , Copy , Print Export data to specific format. Column Reordering by dragging column. Column Filtering Fixed Header - where header stays on top even when scrolling Row details with XAML template for details. Row Grouping Drag & Drop Row Order The features above in my opinion should be standard in all datagrids. If you want to make datagrid stand out to the html world then I would also include the following. I find myself many times looking at a datagrid and then settling on a listview as the datagrid lacks these features. Sideswipe the row to include features like edit , delete , flag etc. The above features handle mainly the "presentation of data" , what is still lacking from WinUI is what I believe should be a native WinUI feature (control ) like the Microsoft Pivot Control. to compliment the datagrid. MS already has the source code for this and it was an absolute awesome control back in the days. https://www.youtube.com/watch?v=ZJIkQ9nebKY Now you cover the presentation and visualization of data that should be the minimum to set WinUI apart from all the basic features out there. Most importantly it really displays the power of "native apps" that should include awesome animations and visually appealing controls that is powerful and looks really cool. I can take this one step further and say after the above features (visualizations) we can include 2D/3D animations that creates a concept of depth in the data and will take us to a different stratosphere , but I guess that is for another day ;)) |
A good starting point is looking at your partner Telerik with their RadDataGrid (UWP Open Source). With one of my clients, I used it and it actually works well. It is hyper fast and versatile. The only thing that is difficult is their code, there is no way to modify anything from their engine without a good comprehension of the architecture. I would expect the new DataGrid to be as performant as Telerik. |
I'm very glad to see the WinUI team is considering a DataGrid control. The most substantial improvements I'd like to see from a new control to replace the Toolkit DataGrid:
|
The option to have an edit button which puts draggable icons next to each row to move the order would be a useful feature. It would also be great to see some shadows behind the row being lifted up and moved (since one of the main Fluent attributes is depth). Small up and down arrows might be good next to the dragging icon to move the rows more easily with mouse input. If a row is moved using the arrows, a subtle sliding animation would be a nice touch. With touch input, the option to hold on a row and just move it without even needing to press the edit button might work well too. I'm not sure if this is already supported, but I could see selection check boxes like in File Explorer making obvious which DataGrids support row selection and just improve the overall UX. The iOS reminders app contains some of these ideas (examples pictured below). The iOS Stocks app also has a similar sort of deal with movable rows. Most of these ideas would also work great for columns. |
Yeah you're probably right @yaichenbaum. I was envisioning those suggestions as the ability to do a custom sort and I thought dragging might be useful for that. So I agree, definitely not default but it might be pretty useful as an option. Thanks for the feedback! |
The simplicity of the WPF datatable to datagrid function. I've actually been fighting for the past week or so trying to get a UWP datagrid to work how I had it in WPF where I could just bind a Datagrid to a Dataview, then fill the Dataview from SQL with a datatable.defaultview. The grid then just displayed the data table. It was amazingly simple to do, and UWP so far has made this ridiculously complicated. |
make it cross platform |
I would like to request a single cell selection mode, excel style. |
Having an assortment of virtualization options that can support different use cases (From plain scrolling virtualization options like recycling to other concepts like data paging) |
If at all possible, the Paging Control #268 proposal, should be synced, and any hooks required be added to the DataGrid control. |
This is good news! I've been waiting for something official on the DataGrid front for a while ever since it appeared in the community toolkit. This is really the last control missing from WinUI 3.0 that the community toolkit doesn't have a good alternative for. First, please, don't reinvent the wheel. As a base start with the WPF implementation of the DataGrid (I know you can't use the code but please use 100% of the API) -- NOT the Silverlight one. The WPF DataGrid was much more feature-complete and has fewer bugs in my testing. In using the community toolkit DataGrid I also requested the following API additions that came up for various use cases Discussion here:
I also continue to have lots of problems with the community tookit DataGrid resetting the scroll position to the top after ItemsSource is changed. This needs to get fixed so the offset is preserved like in WPF; however, we also need to be able to control this which is why I would suggest the following API as well:
|
Suggested new events, and some improvements to preexisting events:
|
I think the most important feature for me would be the ability to easily handle a million rows or more, without having to load a millions rows into memory. The ISupportIncrementalLoading interface isn't good enough for this, because the scroll bar only reflects how many rows you have loaded so far (not total count), and to get to row 1 million, you'd have to keep scrolling to the end over and over and load more and more data, and hope I won't run out of memory. But if I know I have 1 million data records, let me tell the datagrid that, and if I scroll fast or jump to the end, I can be asked to just provide the last few rows. |
This. 'Modern' means lightweight and quick, and enterprise apps are commonly about sorting through tons of internal data to find and explore the appropriate records. Paging, sorting, async incremental loading, endless scrolling - all of these are staples of desktop apps which leverage data grids. MS should produce a sample app which highlights these features in the new grid and collect feedback from enterprise developers over time to make these experiences better. Have it run off of a large dataset like World Wide Importers to demonstrate its effectiveness. |
I wish for that as well. In order to assist with supporting a million rows (and I mean assist, not necessarily the complete solution), I suggest that DataGrid should make its current data-binding technique optional. I believe currently data-binding is mandatory (unless my knowledge is no longer up-to-date with the latest version of DataGrid). DataGrid shouldn't require use of I suggest that DataGrid allow apps to give DataGrid a delegate or interface instance that DataGrid will invoke whenever DataGrid needs to retrieve the value of a cell/column in a row (alternatively, this delegate or interface could retrieve the entire row -- all column values for a specified row). Ideally (if possible), DataGrid would allow this delegate or interface to operate asynchronously. For example, the delegate or interface might return a Alternatively, asynchronous support is also possible without
|
First off, wow!! Thanks so much to everyone who's contributing their ideas. I have a few specific responses below, but overall I wanted to say that I am saving a ton of these comments and really enjoying hearing how we can build an awesome modern DataGrid. Keep it coming! @Pinox thanks so much for that detailed response and the screenshots. Your wishlist is awesome (especially those cool animations!) - I agree that those features found in html are a good inspiration point and are simple but would greatly improve quality of life. Will definitely be saving this comment for future reference! @verelpode, @robloo, @duke7553 YES to DataGrid-specific events! Thank you all for the detail you put into these. As we design for touch-first and for a variety of inputs, events like these should definitely be implemented! @dotMorten, @jkewley, @verelpode Performance is definitely one of the main motivations for this project and one of the main improvements we want to implement, through a new data virtualization story and the use of modern controls such as ItemsRepeater. Will keep you all updated once we have more specifics - but thanks again for these details youve suggested. @Laz3rPanth3r, @robloo, @keeganatorr We hear you loud and clear about liking the DataGrids that belong to WPF and other UI frameworks - we are definitely taking this into account in this refresh! |
Thanks for the great work on DataGrid and the request for feedback! Here are a few more suggested enhancements. Need more subclasses of DataGridColumnThe current subclasses/implementations of
public class DataGridCustomColumn : DataGridColumn
{
public event EventHandler<DataGridDisplayingCellEventArgs> DisplayingCell;
}
public class DataGridDisplayingCellEventArgs : EventArgs
{
public DataGridColumn Column { get; }
public object CellValue { get; }
public Windows.UI.Xaml.UIElement CellUIElement { get; set; } // settable
} When the event The next time DataGrid triggers this event, DataGrid should set the property Also consider the possibility of making the new In the preexisting public class DataGridTextColumn : DataGridColumn
{
public System.Collections.IComparer Comparer { get; set; }
public DataGridCellValueToToStringConverter CellValueToToStringConverter { get; set; }
}
public delegate string DataGridCellValueToToStringConverter(object sourceObject); Alternatively, instead of making the Likewise the Re sorting when a
Access to selected rows/itemsPlease consider improving the functionality for getting and setting the selected rows/items, because the current functionality is insufficient. Currently these properties exist: public int SelectedIndex { get; set; }
public object SelectedItem { get; set; }
public System.Collections.IList SelectedItems { get; } I found that sometimes I needed access to the DataGridRow instances of the selected rows, thus I hope that the following properties can be added to DataGrid: public DataGridRow SelectedRow { get; set; }
public IList<DataGridRow> SelectedRows { get; } Alternatively, if the above is too difficult to implement, the following read-only variation is less powerful but still helpful: public DataGridRow SelectedRow { get; }
public IReadOnlyCollection<DataGridRow> SelectedRows { get; } If DataGridRow instances may be recycled, then the documentation for the above properties should warn that the returned info is only temporarily valid, thus it should be read/used immediately and not retained for a longer length of time. Also, the preexisting public IList<int> SelectedIndexes { get; } // Suggestion.
public int SelectedIndex { get; set; } // Already exists. Personally I find the name "SelectedIndex" confusing because DataGrid is often used in conjunction with a database and the term "index" has a completely different meaning in a database, therefore I suggest renaming the properties as follows, but I expect that my naming suggestion will be rejected: public IList<int> SelectedOrdinals { get; }
public int SelectedOrdinal { get; set; } I also wish for the ability to scroll the specified DataGridRow and/or DataGridColumn into view. Currently this method exists: public void ScrollIntoView(object item, DataGridColumn column); I suggest replacing the preexisting public void ScrollIntoView(DataGridRow row, DataGridColumn column);
public void ScrollItemIntoView(object item, DataGridColumn column); |
Get and set sort-order in one hitWhen apps are opened and closed, they need the ability to save and restore the end-user's configuration of the DataGrid, including the sort order and other settings. Sort order meaning the list of columns that were selected by the user. Note this is a list, not a single column. More than one column may be selected simultaneously, meaning the primary column for sorting, and the secondary column for sorting, and the tertiary column for sorting, etc. Therefore the following property could be made in DataGrid, but actually this is only the first idea and it isn't ideal: public IReadOnlyList<DataGridColumn> SortOrder { get; set; } The above is non-ideal because it doesn't support the saving and restoring of the
That's still problematic because it's multiple hits, meaning it causes multiple time-consuming resorts of the DataGrid. End-users could notice and suffer a significant delay in a DataGrid that contains a large number of rows, when the DataGrid is resorted multiple times unnecessarily. To eliminate this problem, I suggest the following solution that allows apps to restore the complete sort-order in one hit and cause no more than a single resort. public class DataGrid
{
public IReadOnlyList<DataGridColumnAndDirection> SortOrder { get; set; }
...
}
public struct DataGridColumnAndDirection
{
public readonly DataGridColumn Column;
public readonly DataGridSortDirection SortDirection;
public DataGridColumnAndDirection(DataGridColumn, DataGridSortDirection) { ... }
} Note I deliberately wrote When Get and set displayed column order in one hitWhen apps are opened and closed, they need the ability to save and restore the end-user's ordering of the columns, preferably in one hit. I know that the preexisting property Therefore I suggest making a public IReadOnlyList<DataGridColumn> ColumnDisplayOrder { get; set; } The same as I mentioned previously for Allow end-users to hide/show columnsConsistent with the preexisting properties Support GUI elements generated dynamically at runtimeAllow the row-details GUI to be generated without requiring the use of The reason why mandatory use of Drag-and-drop of rows, inwards and outwardsI suggest making the ability to optionally enable outgoing drag-and-drop of rows. DataGrid would implement the drag but not the drop. When the drop occurs, DataGrid would trigger an event and the app responds to the event in order to perform the desired action when the row is dropped outside of the DataGrid. Also the ability to optionally enable incoming drag-and-drop of rows or items/objects. DataGrid would accept incoming drag-and-drop but does not implement the drop. DataGrid would trigger an event when the row/item/object is dropped, and the app responds to the event in order to to perform the desired action when the row is dropped inside the DataGrid. Individual cell backgroundsWe have a feature request from a customer who wants individual cells to be hilited (by changing the cell background color/brush) at certain times (such as when our app detects changes or important values or dangerous values exceeding safety limits etc). Thus I could propose a A better way might be via the event Dumb-down DataGrid's retrieval of data (cell values)I know "dumb" sounds very bad, but in reality I would love it if DataGrid was made dumb in the area of data-retrieval (retrieval of the cell values to be displayed by DataGrid). Currently DataGrid attempts to perform data retrieval in a convenient automatic manner via its property Yes data-binding is a convenient feature, but actually I'd much prefer to have DataGrid do less in that department! Several Microsoft components actually cause large difficulties for me via their behavior of trying to be smart but actually ending up being too smart. Overall I'd actually experience fewer difficulties and less work if these components would cease trying to be so smart/automatic/convenient. When designing an automatic behavior, I find it worthwhile to keep in mind that automatic sounds great but has the potential to backfire. "Just simply let me do it by myself." Ideally I'd like to eliminate the requirement to use the property @anawishnoff wrote:
I see you said the new data virtualization story will improve performance, and that's good news, but will it also eliminate the requirement to use the property If the entire data retrieval job is outsourced to the app that uses DataGrid, then the app has complete flexibility to perform the data retrieval in any manner that it needs. This would enable many different data-retrieval scenarios, including the million rows that @dotMorten mentioned. Dumb it down, please 😄 A few unnecessary features in WPF DataGrid?The WPF version of DataGrid has a few features that seem unnecessary or impractical, and these features could be skipped in WinUI DataGrid, but I expect that some people probably have a different opinion about these features. How many people would raise an objection if WinUI DataGrid abandoned the feature where end-users are able to edit cell values inline/directly inside the DataGrid? In our case, in every place where we use DataGrid, we always set It seems like WinUI DataGrid has already moved in the direction of dropping support for inline/direct editing because WPF DataGrid had Individual cell selection: WPF DataGrid has a On the other hand, individual cell selection might be useful when the user copies rows/cells to the clipboard. It would allow users to copy an individual cell (or several contiguous cells) to the clipboard instead of copying the entire row. However I'm unsure whether this feature is truly valuable or not.
|
Wow, incredible discussion here. ❤️ I also agree to the WPF DataGrid API. The WPF DataGrid is really the DataGrid I want for WinUI 3.0. But even the WPF DataGrid lacks some features. In the past, most of my customers used a more powerful 3rd party DataGrid to get these features:
But anyway, what ever you do, I think building a DataGrid is a powerful statement and commitment to WinUI 3.0. For LOB applications you can't take a UI framework serious that doesn't contain a built-in DataGrid. And it's great to see this investment made for WinUI! |
Agreed! In our case, DataGrid is a critically essential component that we use in multiple places and cannot live without.
I'm torn on that topic because -- like you -- I would find a hierarchical DataGrid useful in some situations, but my concern is that if DataGrid does implement hierarchical functionality, then it could become excessively complex and difficult, and the release of DataGrid would most likely be delayed substantially. New features would be difficult to add because of the complexity of making new features compatible with both hierarchical and non-hierarchical functionality. To eliminate the aforementioned complexity/delays problem, I suggest this solution: Make a separate class named The key advantage of the above solution is that would deliver the desired hierarchical features without bogging down
I agree. Check out the |
Filters would be great for helping end-users quickly find a row or rows, instead of the current situation of being forced to manually look at a large number of rows to find what they're looking for. But what about the problem of matching the user's filter text with non-text columns? Meaning columns other than public delegate void DataGridCellValueToKeywordsConverter(object cellValue, ICollection<string> outputKeywords);
public class DataGridColumn
{
...
public DataGridCellValueToKeywordsConverter CellValueToKeywordsConverter { get; set; }
/// <param name="cellValue">The input/source value of the cell, to be converted to keywords.</param>
/// <param name="outputKeywords">A collection that the method will add the keywords to. The method invokes ICollection.Add for each keyword.</param>
public virtual void ConvertCellValueToKeywords(object cellValue, ICollection<string> outputKeywords)
{
// Subclasses can override this method. The default behavior is to invoke the delegate to do the job.
DataGridCellValueToKeywordsConverter d = this.CellValueToKeywordsConverter;
if (!(d is null)) d(cellValue, outputKeywords);
}
} Here is an example of how to use the void TestKeywords(DataGridColumn column)
{
var keywords = new System.Collections.Generic.HashSet<string>();
foreach (object cellValue in someCellValueList)
{
keywords.Clear();
column.ConvertCellValueToKeywords(cellValue, keywords);
CheckIfFilterTextMatchesAnyKeyword(keywords);
}
} Alternatively, the cell value could be converted to a single string instead of a collection of keywords, but the reason why I suggested a keywords collection is that keywords make it possible to use searching algorithms that run at high speed even when the quantity of rows is very large. |
I know this isn't really the thread for it, but @MEK3DK what would be the current app dev platform to build line-of-business-apps, with C#/.net, and with a good Datagrid component? Was Winforms the last platform that had a rocksolid msft-original Datagrid? |
@tobiasoort WPF has also a great Datagrid component. If not WinUI, I'd go with WPF for windows desktop apps. VS2022 is also a WPF app. :) And the move from WPF to WinUI might be simpler than from WinForms to WinUI, as you can re-use a lot of your XAML knowledge. And, as we're already in a general discussion: .NET MAUI and/or Blazor Hybrid with .NET and C# could also be an option to build a line-of-business desktop app with .NET and C# (You can host the Blazor UI for example inside of Windows Forms or WPF). There's no Datagrid yet, but an interesting experimental Datagrid project from @SteveSandersonMS: |
Blazor is now sampling an experimental data grid package QuickGrid which I believe could be used across different frameworks using Blazor hybrid. Performance is great but you would need to add your own functionality if you need custom filtering etc. Lack of a decent WinUI grid is definitely holding back adoption of WinUI in business. |
The safest bet is likely WPF. The big question is when (and if) Microsoft finish WinUI 3, but if they do then you should be able to move to WinUI 3 without to much work. As the others suggest Blazor could also be an option, but depends on your app needs. I have no knowledge of the DataGrids in Blazor. |
@thomasclaudiushuber @MEK3DK Just to continue this off-topic question a bit more - what would you recommend for business apps with a heavy C++ cross-platform data model that also need heavy use of a Datagrid component? |
@StevoSM QT. It's cross platform and applications are written in C++ so must if the code should stay the same. |
For those staying in the .NET/C# ecosystem recommend switching to Avalonia. They accept changes to the DataGrid though which is from the same code base as the WCT. Avalonia is what Microsoft should have done 10 years ago. |
Can someone please clean this up and keep it about winUi 3? I dont mind helping with current issue, but this is not the place to promote Avalonia nor chat room. |
Microsoft is no longer accepting any changes to the Windows Community Toolkit DataGrid. The DataGrid issue here in WinUI3 is delayed indefinitely. The existing DataGrid has too many shortcomings for a lot of apps. We are discussions what apps can do that require more from their DataGrid. 3rd party controls and switching to other frameworks is absolutely relevant with the mentioned constraints Microsoft had imposed. |
@robloo It's relevant - but it is not relevant here. This thread has become a mess of off-topic discussions (include my comment here - sorry). Hopefully we can agree to end it here, and continue that discussion elsewhere. |
Any movement on this fundamentally important control? Having tried to use the WCT Datagrid with limited success in Winui 3 it would be encouraging to hear from MS that after the passage of several years, plenty of suggestions, and plenty of third-party alternatives to glean functionality from, there is a firm intention and timescale to deliver this |
It seems that the progress has become far away, now is the era of artificial intelligence, AI can better help to write code, whether can let the code implementation become faster? |
. |
If not using C++:
|
Hello! I'm beginner in WinUI 3 in C++. Interested in a DataGrid for my applications. Any update about it? We are finishing 2023 and see no news about a DataGrid native control en WinUI 3. Maybe any plan to implement soon? |
There will be no DataGrid native control, at least not called so. According to latest roadmap, Microsoft are planning a TableView control. |
I guess the team should close this discussion with a comment. |
|
I agree but It's a shame as this issue was actually opened by MS to canvas opinion on a new Datagrid and then abandoned. Blazor recognized need for a datagrid and developed Desktop UI on .NET is a complete mess right now. I know many devs who are abandoning .NET for any form of desktop UI and that includes myself at the moment (I've switched language to get better GUI support). MS doesn't really have anything today that is usable without major issues and with no real guidance provided the fear is these new tools will also be 'Silverlighted'. Sorry to put a downer on net8.0 launch day. |
In all fairness, Table View is just that: a successor to Data Grid, because, to be honest, the Data Grid from WCT is bloated, just like most grids from third party devs. A lean, fast and simple control with full MVVM focus is all we need.
You are right, but the mess has been around ever since Windows 8, where the roadmap became vague as Longon fog. Today the only really usable thing is WinForms and WPF to a good extend. Or WinRT, if you are a C++ guy. But, to be honest, I also don't know any other good tools for Windows native development. |
Avalonia UI has fulfilled all needs in this space. With v11 it is feature complete to be at WPF's-level across all desktop platforms (more like WPF 2.0 with the more powerful styling system, et al.). I've personally ported a moderately sized UWP app to Avalonia and it actually makes quite a few things better. UWP needed a lot of work-arounds and was missing way more functionality compared to WPF. Avalonia UI is much easier to use across the board: Fully featured (more than UWP), More advanced features, fully cross-platform, right at home on Windows, Latest C# support, AOT support, better/faster dev-loop. I won't comment further as people become pretty polarized on this but it's undeniably a better road ahead than WinUI. |
Please. Every time there is a discussion about any Xaml-based development, a guy from Avalonia will jump into it and start preaching offtopic. I am not willing to bet my client's future on a third-party library with a tiny community and loud, arrogant attitude. |
I have personally used WPF, UWP and soon Avalonia in commercial/professional apps. My day job is not Avalonia and is in fact WPF at present. There is no arrogance here other than what you bring. I am simply saying that from a high level other options are on the table. It's wise to fully consider them especially since Microsoft has moved away from this space and the WinUI dev team is probably around 5 developers. You've got me to reply as I feel your response is unnecessarily antagonistic and missing the point; I'll leave it at that as we are now off topic. |
Thank you for your comments, everyone! We really appreciate all the insightful feedback. As @nikolayvpavlov mentioned up above, we are indeed focusing on a Table View control moving forward. As mentioned in the 1.5 roadmap, we are doing initial investigations and design right now and will continue communicating further progress and timelines when we have them. Thanks! |
Discussion: Modern WinUI DataGrid
Hey community members! We've seen that DataGrid has been a valuable piece of the Windows Community Toolkit for many of you and we are interested in graduating it to a native WinUI control (!!). I need your help to figure out what would be needed to make a full-scale DataGrid the best it can be.
I want to hear your input on all things DataGrid. To get started, feel encouraged to answer as few or as many questions as you have time for:
Thanks in advance everyone! See below links for some refreshers and context.
Related Links
Read up on the DataGrid documentation
Download and interact with DataGrid via the DataGrid Nuget package download
Refresh your knowledge by checking out the existing open source DataGrid implementation in the WCT.
The text was updated successfully, but these errors were encountered: