uno.toolkit.ui icon indicating copy to clipboard operation
uno.toolkit.ui copied to clipboard

CommandExtensions.Command does not work in mvux:FeedView

Open Zerachiel01 opened this issue 9 months ago • 2 comments

Current behavior

Hello! So I tried using the CommandExtensions.Command on a ListViewBase to bind the ItemClicked event to a method in my ViewModel. If I just use a plain ListView in my Page, everything works fine, my method in the ViewModel is called when I click on an entry of the ListView. If I now move my ListView inside a mvux:FeedView, my method is not getting called anymore.

Expected behavior

CommandExtensions.Command should bind the ItemClicked event to my ViewModel method, even if the ListViewBase is inside a mvux:FeedView.

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

To reproduce the problem, one must create a project with a ListView that is bound to an IListFeed and bind the CommandExtensions.Command property to a public method of the bound ViewModel. Like this, everything works fine, if I click an item of the ListView, my bound method is called. The corresponding page content might look like this

    <ListView ItemsSource="{Binding ListViewItems}"
            IsItemClickEnabled="True"
            utu:CommandExtensions.Command="{Binding ListViewItemClicked}">
      <ListView.ItemTemplate>
        <DataTemplate>
          <TextBlock Text="{Binding}" />
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>

If you now add the ListView to a mvux:FeedView like this:

    <mvux:FeedView Source="{Binding ListViewItems}">
      <DataTemplate>
        <ListView ItemsSource="{Binding Data}"
            IsItemClickEnabled="True"
            utu:CommandExtensions.Command="{Binding ListViewItemClicked}">
          <ListView.ItemTemplate>
            <DataTemplate>
              <TextBlock Text="{Binding}" />
            </DataTemplate>
          </ListView.ItemTemplate>
        </ListView>
      </DataTemplate>
    </mvux:FeedView>

, the bound method is not called when clicking on an item.

In my attached sample project, I added both versions of the ListView to a single page, both bound to the same method in the ViewModel, the second one is inside a mvux:FeedView. If you click on an item of the first ListView, a message box appears. If you click on an item of the second one, nothing happens.

UnoApp.zip

Nuget Package:

Package Version(s): Uno Platform 5.2

Affected platform(s):

  • [x] WebAssembly
  • [x] Android
  • [ ] iOS
  • [ ] macOS (AppKit)
  • [ ] Mac Catalyst
  • [ ] Skia
    • [ ] WPF
    • [ ] GTK (Linux)
    • [ ] Linux Framebuffer
    • [ ] Tizen
  • [x] Windows

Note: I am not able to test on any other platform.

IDE:

  • [x] Visual Studio 2022
  • [ ] Visual Studio 2019
  • [ ] Visual Studio Code
  • [ ] Visual Studio for Mac
  • [ ] Rider Windows
  • [ ] Rider macOS

Relevant plugins:

Anything else we need to know?

Zerachiel01 avatar May 03 '24 20:05 Zerachiel01

Fyi @Xiaoy312

kazo0 avatar May 03 '24 22:05 kazo0

also cc @dr1rrb if it is maybe an MVUX thing

kazo0 avatar May 07 '24 12:05 kazo0