[Preview-4] winui Listview control not binding to observable collection within UWP app #4216
Labels
product-winui3
WinUI 3 issues
team-Markup
Issue for the Markup team
version-winui3preview4
WinUI 3 Preview 4 issues
Describe the bug
Not sure if this should be in ReUnion or not???
The WinUI ListView control is not binding correctly to an Observable collection in a Winui in UWP app.
The very simple code below illustrates the point.
Exactly the same code in a Winui in Desktop works fine, as does the same code in a std non winui UWP app.
Steps to reproduce the bug
Create a new Winui in UWP program and replace the following ...
MainPage.xaml
MainPage.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System.Collections.ObjectModel;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace TestOBSuwp
{
///
/// An empty page that can be used on its own or navigated to within a Frame.
///
public sealed partial class MainPage : Page
{
ObservableCollection myItems = new ObservableCollection();
}
Expected behavior
Expect the ListView to bind to the ObservableCollection.
Screenshots
This screen snip shows std UWP, winui in desktop, and winui in UWP versions of the test code above running.
Clicking the button adds an item to the observable collection and displays the collection count in the button text. The bound ListView should display itims as they are added. The stdUWP and winui in desktop verisons (the top two) work fine. The winui in UWP version only shows the item added in the page init routine even though it is clear the items are being added to the collection. Removing the item add in the init routine results in a completely blank ListView - items are still not added from the click event.
Version Info
NuGet package version:
Windows app type:
Additional context
The text was updated successfully, but these errors were encountered: