Beispiel #1
0
 private void InputDeviceEvents_PreProcessInput(object sender, PreProcessInputEventArgs e)
 {
     if (e.StagingItem.Input.Device is TouchDevice)
     {
         InputReportEventArgs irea = e.StagingItem.Input as InputReportEventArgs;
         if (irea != null)
         {
             RawTouchInputReport rtir = irea.Report as RawTouchInputReport;
             if (rtir != null)
             {
                 int x = rtir.Touches[0].X;
                 int y = rtir.Touches[0].Y;
                 PointToClient(ref x, ref y);
                 if (!Utils.IsWithinRectangle(x, y, ActualWidth, ActualWidth))
                     e.Cancel();
             }
         }
     }
 }
Beispiel #2
0
        private void InputDeviceEvents_PreProcessInput(object sender, PreProcessInputEventArgs e)
        {
            if (e.StagingItem.Input.Device is TouchDevice)
            {
                InputReportEventArgs irea = e.StagingItem.Input as InputReportEventArgs;
                if (irea != null)
                {
                    RawTouchInputReport rtir = irea.Report as RawTouchInputReport;
                    if (rtir != null)
                    {
                        // cancel any touch event that does not start within the modal window
                        //if (!this.ContainsPoint(rtir.Touches[0].X, rtir.Touches[0].Y))
                        //    e.Cancel();

                        int x = rtir.Touches[0].X;
                        int y = rtir.Touches[0].Y;
                        PointToClient(ref x, ref y);
                        if (!Utils.IsWithinRectangle(x, y, ActualWidth, ActualWidth))
                            e.Cancel();
                    }
                }
            }
        }