Exemple #1
0
        private void DocumentView_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (Keyboard.IsKeyDown(Key.LeftAlt))
            {
                return;
            }
            DocumentViewModel viewModel     = DataContext as DocumentViewModel;
            FrameworkElement  sourceControl = e.OriginalSource as FrameworkElement;

            if (sourceControl != null)
            {
                viewModel?.DeselectAll();
                SelectNearLine(e);
                if (e.ChangedButton == MouseButton.Left)
                {
                    IContentSelectable selectableContent = sourceControl.DataContext as IContentSelectable;
                    if (selectableContent?.CanSelect == true)
                    {
                        _isDragging = true;
                        viewModel?.StartSelection(e.GetPosition(CanvasItemContainer));
                    }
                }
            }
        }