Reputation: 180
I am making an application with the .net maui framework
With buttons, it is possible to add the Clicked
argument to call a function. But I would like to apply it on a group of elements like HorizontalStackLayout
or other than a button like Label
and Image
.
<ContentPage ...>
<ScrollView>
<VerticalStackLayout>
<HorizontalStackLayout>
<Image Source="assets/profil/EnzoDeg40.png" />
<VerticalStackLayout>
<Label Text="EnzoDeg40"/>
<Label Text="On mange des frites ce soir ?"/>
</VerticalStackLayout>
</HorizontalStackLayout>
...
</VerticalStackLayout>
</ScrollView>
</ContentPage>
Upvotes: 1
Views: 1087
Reputation: 180
As Jason mentions, add a Gesture Recognizer as a child allows you to add an "OnClick" to a group
<HorizontalStackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="OnCounterClicked"/>
</HorizontalStackLayout.GestureRecognizers>
Upvotes: 1