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 · 1 comment
Open

[WinAppSDK] Visual Tree stores wrong outdated Items #19068

AuderixDev opened this issue Dec 12, 2024 · 1 comment
Labels
area/external Categorizes an issue or PR as being external to the Uno

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
@jeromelaban
Copy link
Member

Thanks for the report! We're not managing the implementation of TreeView when running on WinAppSDK, though we're pulling the source from the official implementation into Uno.

It would be best to open this issue in the WinUI repository, once it's fixed there we can import it into Uno.

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

No branches or pull requests

2 participants