-
Hi, Apologies if this is the wrong place to ask these questions. I have been trying out WinUI3 in both C# and C++. I can get ListView groups to bind through CollectionViewSource in C# but I have not been successful with C++. I can get the groups to show up but not the items under the groups. I have tried binding using both "is-a-group" by inheriting from IObservableVector, and "has-a-group" by returning an IObservableVector as a property. I get the same results with both. I have created a quick example of what I am trying to do below. This example uses "has-a-group". https://github.com/pmintusEA/WinUI3CppListViewGroups ![]() Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I had exactly the same issue. I'm working in C++/CX so my method my not work in C++/WinRT but what I did was set the ItemsPath property of my CollectionViewSource to the name of the collection property on my group object that contains the items. The real trick, though, was that the collection property of the group object had to be defined as DependencyProperty - seems ItemsPath is meant to work only on those. So that's why I'm not sure if it'll work in C++/WinRT but I hope this helps! |
Beta Was this translation helpful? Give feedback.
-
The fix was to upgrade to the latest version of the WindowsApp SDK (1.4.230811000-preview2) from 1.2.230217.4 and use the Windows.UI.Xaml.Data.Bindable attribute on the runtimeclass that contains the property containing the listview items. Both changes were required. Simply adding the attribute to the runtimeclass on SDK version 1.2 did not fix the issue. |
Beta Was this translation helpful? Give feedback.
The fix was to upgrade to the latest version of the WindowsApp SDK (1.4.230811000-preview2) from 1.2.230217.4 and use the Windows.UI.Xaml.Data.Bindable attribute on the runtimeclass that contains the property containing the listview items.
Both changes were required. Simply adding the attribute to the runtimeclass on SDK version 1.2 did not fix the issue.
pmintusEA/WinUI3CppListViewGroups@7743145