Пример #1
0
        /// <summary>
        /// Item clicked
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
        {
            base.OnPreviewMouseDown(e);
            DesignerCanvas canvas = VisualTreeHelper.GetParent(this) as DesignerCanvas;

            if (canvas != null)
            {
                if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                {
                    IsSelected = !IsSelected;
                    DesignerCanvas.SetZIndex(this, !IsSelected ? ZIndexUnSelectedValue : ZIndexSelectedValue);
                    canvas.DeselectLabels();
                }
                else
                {
                    if (!IsSelected)
                    {
                        canvas.ResetZIndexes();
                        canvas.DeselectLabels();
                        canvas.DeselectTables();
                        IsSelected = true;
                        DesignerCanvas.SetZIndex(this, ZIndexSelectedValue);
                    }
                }
            }
            e.Handled = false;
        }