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

Button Command will not fire when inside flyout inside list #19065

Open
KWodarczyk opened this issue Dec 11, 2024 · 3 comments
Open

Button Command will not fire when inside flyout inside list #19065

KWodarczyk opened this issue Dec 11, 2024 · 3 comments
Labels
area/external Categorizes an issue or PR as being external to the Uno

Comments

@KWodarczyk
Copy link

KWodarczyk commented Dec 11, 2024

Current behavior

inside the list When clicking button that is inside the flyout it should increment the counter same way as clicking the button outside the list

<Page x:Class="UnoBugsApp.Presentation.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:UnoBugsApp.Presentation"
      xmlns:uen="using:Uno.Extensions.Navigation.UI"
      xmlns:utu="using:Uno.Toolkit.UI"
      NavigationCacheMode="Required"
      RequestedTheme="Dark"
      Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  <ScrollViewer>
    <Grid utu:SafeArea.Insets="VisibleBounds">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition />
      </Grid.RowDefinitions>
      <utu:NavigationBar Content="{Binding Title}" />

      <StackPanel Grid.Row="1"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Spacing="16">
        <TextBox Text="{Binding Name, Mode=TwoWay}"
            PlaceholderText="Enter your name:" />

        <Button Content="Go to Second Page"
            AutomationProperties.AutomationId="SecondPageButton"
            Command="{Binding GoToSecond}" />

        <StackPanel DataContext="{x:Bind TestViewModel}" x:Name="testList">

            <!--this works fine in weasm-->
            <Button Content="Button with flyout not in the list" Foreground="Green" BorderBrush="Green" >
                 <Button.Flyout>
                   <Flyout>
                     <Button Content="Increment"
                     Command="{Binding ElementName=testList, Path=DataContext.TestCommand}"/>
                   </Flyout>
                 </Button.Flyout>
               </Button>

               <TextBox Text="{Binding ElementName=testList, Path=DataContext.Count}"
                   PlaceholderText="Counter" />

            <!--this does not work in wasm nor windows apps sdk-->
            <ItemsRepeater ItemsSource="{x:Bind TestViewModel.TestList}"  >

              <ItemsRepeater.ItemTemplate>
                <DataTemplate>
                <StackPanel Spacing="10">

                  <Button Content="Button with flyout in the list" AllowFocusOnInteraction="True" Foreground="Red" BorderBrush="Red" >
                      <Button.Flyout>
                        <Flyout Placement="RightEdgeAlignedTop" AllowFocusOnInteraction="True">
                          <Button Content="Increment"
                                Command="{Binding ElementName=testList, Path=DataContext.TestCommand}"/>
                          </Flyout>
                      </Button.Flyout>
                    </Button>

                    <TextBox Text="{Binding ElementName=testList, Path=DataContext.Count}"
                            PlaceholderText="Counter" />
                  </StackPanel>

                </DataTemplate>
              </ItemsRepeater.ItemTemplate>

            </ItemsRepeater>

            <!--this will work-->
           <ItemsRepeater ItemsSource="{x:Bind TestViewModel.TestList}"  >

              <ItemsRepeater.ItemTemplate>
                <DataTemplate>
                <StackPanel Spacing="10">

                  <Button
                    Content="Button in the list no flyout"
                    Command="{Binding ElementName=testList, Path=DataContext.TestCommand}"
                    AllowFocusOnInteraction="True"
                    Foreground="Green" BorderBrush="Green" >
                  </Button>

                    <TextBox Text="{Binding ElementName=testList, Path=DataContext.Count}"
                            PlaceholderText="Counter" />
                  </StackPanel>

                </DataTemplate>
              </ItemsRepeater.ItemTemplate>

            </ItemsRepeater>
        </StackPanel>

      </StackPanel>
    </Grid>
  </ScrollViewer>
</Page>

image

Expected behavior

Clicking the button in the list in the flyout should increment the counter

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

Build and run the attached project for wasm and click on the buttons, only green buttons work

UnoBugsApp.zip

Workaround

need to use Click event

Works on UWP/WinUI

None

Environment

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

NuGet package version(s)

"Uno.Sdk": "5.5.54"

Affected platforms

WebAssembly, Windows (WinAppSDK)

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@KWodarczyk KWodarczyk 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 11, 2024
@jeromelaban
Copy link
Member

Thanks for the report!

Could you validate that it also does not work with the netX.0-windows target?

@jeromelaban jeromelaban added project/binding 🪢 Categorizes an issue or PR as relevant to the binding engine triage/needs-information Indicates an issue needs more information in order to work on it. labels Dec 16, 2024
@KWodarczyk
Copy link
Author

KWodarczyk commented Dec 18, 2024

tested for net8.0-windows10.0.19041; windows apps sdk packaged and same issue

@github-actions github-actions bot removed the triage/needs-information Indicates an issue needs more information in order to work on it. label Dec 18, 2024
@jeromelaban
Copy link
Member

jeromelaban commented Dec 18, 2024

Thanks for the update.

If the behavior is not working on windows apps sdk packaged, this means that it is not a behavior we'll change in Uno either.

This means you'll need to work this behavior differently, using XAML behaviors or code-behind.

@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 project/binding 🪢 Categorizes an issue or PR as relevant to the binding engine difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Dec 18, 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