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

[WinAppSDK] Visual Tree stores wrong outdated Items #19068

Open
AuderixDev opened this issue Dec 12, 2024 · 0 comments
Open

[WinAppSDK] Visual Tree stores wrong outdated Items #19068

AuderixDev opened this issue Dec 12, 2024 · 0 comments
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@AuderixDev
Copy link

Current behavior

Working with Listview and ListView.ItemTemplate I noticed a strange behaviour on some CommandParameters.
I debugged it with the Visual Tree Viewer and noticed, that after removing items from the Listview, some items are reappearing.
Further interactions with the ListView leads to wrong CommandParameters.

Not tested on other platforms!

Expected behavior

The Visual Tree should represent the underlaying data.

How to reproduce it (as minimally and precisely as possible)

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();
  }
...

uno

Minimal Project: UnoApp14.zip
(Startup Project. WinAppSDK Unpacked)

Workaround

No response

Works on UWP/WinUI

No

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

No response

Affected platforms

Windows (WinAppSDK)

IDE

Visual Studio 2022

IDE version

17.11.5

Relevant plugins

No response

Anything else we need to know?

No response

@AuderixDev AuderixDev added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

1 participant