First, sorry the title is misleading but I did not manage to properly summarize this in a few words. This is simple use-case but not that simple to implement it seems:
I have a MAUI Windows app, and I have some kind of custom expand button control: when this button is clicked, a list of items is revealed underneath. Now I want the user to have two options: selecting one of the item in the list, or clicking anywhere outside the list, and both these events will make the expand button “unexpended” by setting the IsExpanded property to false. Pretty straightforward.
Now I have considered different options for that, and the most logical seems to add a TapGestureRecognizer to the root view (a Grid) of the page which sets IsExpanded to false when tapped
——> The issue: there are other elements on the page, such as buttons, and I don’t want the user to be unable to click them, but I also want clicking them causing the expanded view to become unexpanded if it was expanded.
The obvious solution is to add the following code to each click event of all the elements on the page but I obviously would like to avoid that:
if (ExpandButton.IsExpanded)
{
ExpandButton.IsExpanded = false;
}
Is there another solution but this ? Thanks a lot for any suggestion