Skip to content
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

XAML Visual Tree does not represent the underlaying data #10240

Open
AuderixDev opened this issue Dec 17, 2024 · 2 comments
Open

XAML Visual Tree does not represent the underlaying data #10240

AuderixDev opened this issue Dec 17, 2024 · 2 comments
Labels
area-Lists ListView, GridView, ListBox, etc bug Something isn't working needs-author-feedback Asked author to supply more information. needs-repro no-recent-activity

Comments

@AuderixDev
Copy link

Describe the bug

Working with Listview and ListView.ItemTemplate I noticed a strange behaviour.
I debugged it with the Visual Tree Viewer and noticed, that after removing items from the Listview, some items are reappearing in the XAML Visual Tree.
Further interactions with the ListView leads to wrong beahviour, like Loaded-Events are not triggered, because the Item already exists.

Steps to reproduce the bug

MainPage.xaml

...
 <ListView ItemsSource="{Binding NameList}" x:Name="outerList">
   <ListView.ItemTemplate>
     <DataTemplate>
       <StackPanel Orientation="Horizontal" x:Name="innerobject">
         <TextBlock Text="{Binding Id}" />
         <Button Content="Remove"
                 Command="{Binding DataContext.RemoveMe, ElementName=outerList}"
                 CommandParameter="{Binding Id}"/>

       </StackPanel>
       
     </DataTemplate>
    </ListView.ItemTemplate>
 </ListView>
...

MainModel.cs

...
  public IListState<Customer> NameList => ListState<Customer>.Empty(this);

  public async Task AddToList()
  {
      await NameList.AddAsync(new Customer());
  }

  public async Task RemoveMe(Guid id)
  {
      await NameList.RemoveAllAsync(match: x => x.Id == id);
  }

  public partial record Customer()
  {
      public Guid Id { get; } = Guid.NewGuid();
  }
...

Expected behavior

The Visual Tree should represent the underlaying data.

Screenshots

uno

NuGet package version

None

Windows version

No response

Additional context

Comes from here: unoplatform/uno#19068
It's not an Uno-Platform-Problem.

@AuderixDev AuderixDev added the bug Something isn't working label Dec 17, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 17, 2024
@karkarl karkarl added area-Lists ListView, GridView, ListBox, etc and removed needs-triage Issue needs to be triaged by the area owners labels Dec 19, 2024
@karkarl
Copy link
Contributor

karkarl commented Dec 19, 2024

Can you attach the repro app that you have in your repro video?

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Lists ListView, GridView, ListBox, etc bug Something isn't working needs-author-feedback Asked author to supply more information. needs-repro no-recent-activity
Projects
None yet
Development

No branches or pull requests

2 participants