public override void MouseLeftButtonDown(QuadDocument document, QuadCanvas canvas, System.Windows.Input.MouseButtonEventArgs e) { startPoint = e.GetPosition(canvas); QuadCanvasItem item = canvas.GetItemHit(startPoint); bool shifyKeyPressed = Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift); if (item != null) { if (shifyKeyPressed) { canvas.SelectedItems.Add(item.Quadrilateral); } else { canvas.SelectedItem = item.Quadrilateral; } } else { if (!shifyKeyPressed) { canvas.SelectedItem = null; } inMove = false; } }
void QuadCanvas_SelectionChanged(object sender, SelectionChangedEventArgs e) { foreach (Quadrilateral q in e.AddedItems) { QuadCanvasItem item = QuadToCanvasItem(q); if (item != null) { item.IsSelected = true; } } foreach (Quadrilateral q in e.RemovedItems) { QuadCanvasItem item = QuadToCanvasItem(q); if (item != null) { item.IsSelected = false; } } }
private static void OnQuadrilateralChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { QuadCanvasItem canvasItem = d as QuadCanvasItem; canvasItem.Quadrilateral_Changed(e); }
private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { QuadCanvasItem canvasItem = d as QuadCanvasItem; canvasItem.UpdateView(); }