Ejemplo n.º 1
0
 private void Grid_KB_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (!m_KBlayout_enable)
     {
         return;
     }
     if (e.ChangedButton == MouseButton.Left)
     {
         SetKeyForcused(sender, e);
         isLeftMouseButtonDownOnWindow = true;
         origMouseDownPoint            = e.GetPosition(Grid_KB);
         Grid_KB.CaptureMouse();
         e.Handled = true;
     }
 }
Ejemplo n.º 2
0
        private void Grid_KB_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (!m_KBlayout_enable)
            {
                return;
            }
            if (e.ChangedButton == MouseButton.Left)
            {
                bool wasDragSelectionApplied = false;

                if (isDraggingSelectionRect)
                {
                    //
                    // Drag selection has ended, apply the 'selection rectangle'.
                    //

                    isDraggingSelectionRect = false;
                    ApplyDragSelectionRect();

                    e.Handled = true;
                    wasDragSelectionApplied = true;
                }

                if (isLeftMouseButtonDownOnWindow)
                {
                    isLeftMouseButtonDownOnWindow = false;
                    Grid_KB.ReleaseMouseCapture();

                    e.Handled = true;
                }

                if (!wasDragSelectionApplied)
                {
                    //
                    // A click and release in empty space clears the selection.
                    //
                    //listBox.SelectedItems.Clear();
                }
            }
        }