You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Buttons or any view not firing inside Layout that has a TouchBehavior #2429
The touch behavior in the parent view overrides the event on the nested view.
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<VerticalStackLayout.Behaviors>
<mct:TouchBehavior PressedOpacity="0.5"/>
</VerticalStackLayout.Behaviors>
<Image
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a hovercraft number nine" />
<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />
<Label
Text="Welcome to .NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Fill" />
</VerticalStackLayout>
Expected Behavior
Click on the button should work when a touch behavior is set on the parent view.
Steps To Reproduce
Download the repo and run it.
Click on the button doesn't work while it should work.
I am facing this exact same issue.
I have a border control with a long press command touch behavior and inside is a mct:Expander with a button in the Expander header. I have the button.clicked set to an event in the code behind which never fires
As of today's date, I have the latest communitytoolkit.Maui nuget package. Below is my xaml in case it helps paint the picture
I encountered a similar situation where I needed to manage nested touch behaviors. For example:
In my case, I wanted to tap on the box to focus it while still allowing the dropdown to be used for selecting options.
Initially, I applied touch behaviors to both the parent and child elements, as you might expect. However, I found that the parent’s touch behavior interfered with the child’s. To resolve this, I implemented a workaround where the parent’s touch behavior is temporarily disabled whenever the child’s touch behavior is triggered:
Activity
bricefriha commentedon Jan 7, 2025
I reported the same issue (#2385), but it's meant to be fixed now after the .NET 9 support #2215.
Edit
I confirm the issue is still there on
10.0L3Prichaun13 commentedon Jan 26, 2025
I am facing this exact same issue.
I have a border control with a long press command touch behavior and inside is a mct:Expander with a button in the Expander header. I have the button.clicked set to an event in the code behind which never fires
As of today's date, I have the latest communitytoolkit.Maui nuget package. Below is my xaml in case it helps paint the picture
bradencohen commentedon Jan 28, 2025
I encountered a similar situation where I needed to manage nested touch behaviors. For example:
In my case, I wanted to tap on the box to focus it while still allowing the dropdown to be used for selecting options.
Initially, I applied touch behaviors to both the parent and child elements, as you might expect. However, I found that the parent’s touch behavior interfered with the child’s. To resolve this, I implemented a workaround where the parent’s touch behavior is temporarily disabled whenever the child’s touch behavior is triggered:
While your setup might differ, this approach could still be applicable and help ensure smooth interactions in nested touch scenarios.