ListView reorder sets ListView.Items with TwoWay xBind to null values after initial reorder #7551
Closed
1 of 2 tasks
Labels
area-Lists
ListView, GridView, ListBox, etc
bug
Something isn't working
no-issue-activity
product-winui3
WinUI 3 issues
team-Controls
Issue for the Controls team
Describe the bug
When a ListView item is being reordered with a ListView.ItemTemplate defined with a twoway binding, the value of the twoway binding is being set to null.
The reorder works correctly when reordering the first ListView Item. Once you reorder the 2nd item the value of the twoway binding is being set to null.
Steps to reproduce the bug
Consider the following xaml with the ViewModel defined in the .CS class:
The MainWindowViewModel:
The ListViewItemViewModel:
When you run the application and reorder the ListView the first time, the application works as expected. If you then reorder the ListView again, the setter of the ListViewItemViewModel.String is being set to null.
In my testing, I always reordered the last item in the list to the first item in the list.
Expected behavior
The expectation is the reorder behavior would work the same as the first time the ListView is being reordered.
On the first reorder, the setter of the ListViewItemViewModel.String is not being hit which is correct as there is no change to the value of the property.
Screenshots
No response
NuGet package version
No response
Windows app type
Device form factor
Desktop
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response
The text was updated successfully, but these errors were encountered: