If the Child control is handed a specific TouchEvent and you do not want the parent control to get this event you can set the TouchRoutedEventArgs.Handled property to True to block its routed event.
[C#]
using C1.Win.TouchToolKit;
private void Form1_Load(object sender, EventArgs e) { this.c1TouchEventProvider1.SetEnableTouchEvents(button1, true); this.c1TouchEventProvider1.SetEnableTouchEvents(panel1, true); this.c1TouchEventProvider1.Tapped += new EventHandler<TappedEventArgs>(c1TouchEventProvider1_Tapped); }
private void c1TouchEventProvider1_Tapped(object sender, TappedEventArgs e) { if (e.TargetControl != null) { Console.WriteLine("{0},{1},{2}", DateTime.Now.ToString(), e.TargetControl.Name, e.OriginalSource.Name); e.Handled = true; } } |
[Visual Basic]
Imports C1.Win.TouchToolKit
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load C1TouchEventProvider1.SetEnableTouchEvents(Button1, True) C1TouchEventProvider1.SetEnableTouchEvents(Panel1, True) End Sub
Private Sub C1TouchEventProvider1_Tapped(sender As System.Object, e As TappedEventArgs) Handles C1TouchEventProvider1.Tapped If Not e.TargetControl Is Nothing Then Console.WriteLine("{0},{1},{2}", DateTime.Now.ToString(), e.TargetControl.Name, e.OriginalSource.Name) e.Handled = True End If End Sub |