Description
I've checked in a spike to the following branch android_secondary_click.
The right click action when you have a mouse attached to a tablet by default just navigates back.
It's a bit awkward because the right click fires through KeyEvents so you just repurpose the Back keybutton that originates from a mouse as a "secondary" click.
You also have to wire up to the Click event. You don't have to actually do anything inside the click event but you have to add a clicklistener for all this to wire up
void SetupGestures()
{
if (View == null)
return;
var platformView = Control;
if (platformView == null)
return;
if (View.GestureRecognizers.Count == 0)
{
platformView.Touch -= OnPlatformViewTouched;
platformView.KeyPress -= OnPlatformViewKeyPressed;
}
else
{
platformView.Touch += OnPlatformViewTouched;
platformView.KeyPress += OnPlatformViewKeyPressed;
bool testMe = platformView.HasOnClickListeners;
platformView.Click += PlatformView_Click;
}
}
void PlatformView_Click(object? sender, EventArgs e)
{
}
void OnPlatformViewKeyPressed(object? sender, AView.KeyEventArgs e)
{
if (_disposed)
{
var platformView = Control;
if (platformView != null)
{
platformView.Touch -= OnPlatformViewTouched;
platformView.KeyPress -= OnPlatformViewKeyPressed;
}
return;
}
if ((e.Event?.Source & InputSourceType.Mouse) == InputSourceType.Mouse && e.KeyCode == Keycode.Back)
{
}
Description
I've checked in a spike to the following branch android_secondary_click.
The right click action when you have a mouse attached to a tablet by default just navigates back.
It's a bit awkward because the right click fires through
KeyEventsso you just repurpose theBackkeybutton that originates from a mouse as a "secondary" click.You also have to wire up to the
Clickevent. You don't have to actually do anything inside the click event but you have to add aclicklistenerfor all this to wire up