示例#1
0
 /// <summary>
 /// Updates the combo box's input capture state.
 /// </summary>
 private void UpdateInputCapture(Boolean captured)
 {
     if (captured)
     {
         if (Ultraviolet.GetInput().IsMouseCursorAvailable)
         {
             Mouse.Capture(View, this, CaptureMode.SubTree);
         }
         else
         {
             Touch.CaptureNew(View, this, CaptureMode.SubTree);
         }
     }
     else
     {
         if (Ultraviolet.GetInput().IsMouseCursorAvailable)
         {
             if (IsMouseCaptured)
             {
                 Mouse.Capture(View, null, CaptureMode.None);
             }
         }
         else
         {
             if (AreNewTouchesCaptured)
             {
                 Touch.CaptureNew(View, null, CaptureMode.None);
             }
         }
     }
 }
示例#2
0
        /// <summary>
        /// Occurs when the control handles a <see cref="Touch.LostNewTouchCaptureEvent"/> routed event.
        /// </summary>
        private static void HandleLostNewTouchCapture(DependencyObject dobj, RoutedEventData data)
        {
            var comboBox = (ComboBox)dobj;

            if (comboBox.Ultraviolet.GetInput().IsMouseCursorAvailable)
            {
                return;
            }

            if (comboBox != data.OriginalSource)
            {
                if (comboBox.ContainsDescendant(data.OriginalSource as DependencyObject))
                {
                    if (Touch.GetCapturedNew(comboBox.View) == null)
                    {
                        Touch.CaptureNew(comboBox.View, comboBox, CaptureMode.SubTree);
                        data.Handled = true;
                    }
                }
                else
                {
                    comboBox.IsDropDownOpen = false;
                }
            }
        }