I am creating a custom control. I want to change the Background Color When Touched using Custom Effects in the Native Code and also handle the TapGesture Event in the Event Handler in the backend code. But When I do this only one of these two is happening (ie. When I define Grid.GestureRecognizer first and then Grid.Effect then Grid.Effect is only getting executed and vice versa). As both are dependent on OnTouch Events one is getting overridden by the other. How to tackle this.
In Xaml file:
<.Grid >
<Grid.GestureRecognizers>
<TapGestureRecognizerTapped="OnTapGestureRecognizerTapped"/>
</Grid.GestureRecognizers>
<Grid.Effects>
</Grid.Effects>
//OtherCode
</.Grid>
In Backend Code:
event EventHandler Click;
void OnTapGestureRecognizerTapped(object sender, EventArgs args)
{
if (Click != null)
Click.Invoke(this, args);
}
In Native Code The Effect.cs
protected override void OnAttached()
{
Container.SetOnTouchListener(new MyOnTouchListener());
}
public class MyOnTouchListener : Java.Lang.Object, Android.Views.View.IOnTouchListener
{
public bool OnTouch(Android.Views.View v, MotionEvent e)
{
switch (e.Action)
{
}
}
}
Or is there anyother efficient way of doing this?