i have button in my windows phone silverlight 8.1 app i created two event one click event and second hold event, i want when user hold such button then click event should not fire, but currently when i hold button and then leave that button click button also fires, so how to handle that.
private void ExtraButton_Click(object sender, RoutedEventArgs e)
{
}
private void ExtraButton_Hold(object sender, GestureEventArgs e)
{
}
so how to cancel click event when hold event performed.
I suggest you can replace the Button Click event with Button Tap event, because when you hold this button, the Button Hold event will be triggered firstly.
private void button1_Hold(object sender, System.Windows.Input.GestureEventArgs e)
{
e.Handled = true;
MessageBox.Show("button have been holded");
}
private void button1_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
MessageBox.Show("button have been tapped");
//your code goes here
}
After you set Handled property as true, then the Button Click event will not handle your gesture.