Commands and gestures
Handle discrete actions and continuous touch gestures without replacing native control behavior.
Interactive controls use ICommand for actions that fit MVVM. CommunityToolkit commands can be assigned directly. Command.From creates a small command when the action belongs in the view:
The MVVM and binding guide covers how command-owning ViewModels attach to typed pages.
CanExecute controls whether a command-backed native control is enabled. Raise the command's normal CanExecuteChanged event when that state changes.
Shared view interaction
Every View supports:
TapCommandand an optionalTapCommandParameterDoubleTapCommandand an optionalDoubleTapCommandParameterLongPressCommand, an optionalLongPressCommandParameter, andLongPressDurationPressed, which reports touch-down and release/cancellationPanned,Pinched, andRotatedfor continuous gestures
The continuous callbacks receive state and geometry. Apply values while the gesture is Changed, then settle the view when it ends:
Setting these callbacks installs native recognizers without preventing child controls from receiving their own touches. AddNativeGesture is the lifecycle-aware escape hatch when a UIKit gesture recognizer is needed directly; see native interop.
Use interactive animators when a pan or pinch should scrub an animation rather than applying its final state immediately.
Context menus
Add MenuAction entries to any view's ContextMenu:
Collection item menus use the current item automatically when CommandParameter is null. Buttons also expose a menu; their control page covers the button-specific behavior.
Pointer and enabled state
IsEnabled disables touch interaction and updates the native enabled appearance where the control supports one. On iPad, PointerEffect selects the hover treatment shown for a trackpad or mouse. It defaults to None.
Use Focus() and Unfocus() for keyboard focus. Calling Focus() before a view has been realized is a no-op, so initial focus normally belongs in OnAppeared.