public void DeleteSelected()
 {
     SelectedLayoutElement.RestartSelectionState();
     elements.Remove(SelectedLayoutElement);
     _canvas.Children.Remove(Selected);
     _selected = null;
 }
 private void _canvas_MouseLeave(object sender, MouseEventArgs e)
 {
     if (SelectedLayoutElement != null)
     {
         SelectedLayoutElement.RestartSelectionState();
     }
 }
        private void _canvas_MouseMove(object sender, MouseEventArgs e)
        {
            //Handle template mouse hover event
            if (!mouseDown)
            {
                var result = _canvas.InputHitTest(e.GetPosition(_canvas));

                if (result is UIElement)
                {
                    _target = result as UIElement;
                    if (_template.IsEditable(_target))
                    {
                        Mouse.OverrideCursor = TargetLayoutElement.HoverCursor(e.GetPosition(result));
                    }
                    else
                    {
                        Mouse.OverrideCursor = Cursors.Arrow;
                    }
                }
            }
            else if (mouseDown && Selected != null)
            {
                SelectedLayoutElement.HandleMouseInteraction(e);
            }
        }
 private void _canvas_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     if (Selected != null)
     {
         SelectedLayoutElement.Rotate(e.Delta > 0 ? 10 : -10);
     }
 }
 private void _canvas_MouseUp(object sender, MouseButtonEventArgs e)
 {
     mouseDown = false;
     if (SelectedLayoutElement != null)
     {
         SelectedLayoutElement.RestartSelectionState();
     }
 }