Input cancellation - .NET MAUI
In MAUI, you can simply use the IsEnabled
property if you want to disable user interaction. You can also subscribe to the Command
, Clicked
, or Pressed/Released
events if the component is actionable, like a Button. If the component doesn't offer an action, you can use any Gesture Recognizer
to capture user interactions.
var button = new Button();
button.Clicked += (sender, args) =>
{
//Apply any logic
};
button.Pressed += (sender, args) =>
{
//Apply any logic
};
button.Released += (sender, args) =>
{
//Apply any logic
};
<Button Text="Hello"
Clicked="Button_Clicked"
Pressed="Button_Pressed"
Released="Button_Released" />