Cancelling Collapsing of Xamarin Community Toolkit's Expander

Nathan Sokalski 4,121 Reputation points
2021-01-28T22:36:02.353+00:00

When the user taps the header of the Expander from Xamarin Community Toolkit (https://learn.microsoft.com/en-us/xamarin/community-toolkit/views/expander), it shows or hides the content, as expected. However, when the user taps the header to collapse the Expander, I want to confirm it by displaying a message, and possibly cancel the collapsing. The 2 events triggered when tapping the header are Tapped & PropertyChanging, and I am not sure what I could do in either of these to cancel the collapsing. I could try to add code to these events to set the IsExpanded property, but this would be inefficient and would most likely cause a strange looking UI (showing & hiding the content multiple time, and possibly triggering extra unwanted events). Any ideas? Thanks.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,302 questions
{count} votes