示例#1
0
        private void ClickGroupChildInEdited()
        {
            ClickInitialStatus = GroupStatus.Edit;
            DesignerCanvas  designer = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(this))) as DesignerCanvas;
            IGroupOperation pageVM   = designer.DataContext as IGroupOperation;

            if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
            {
                this.IsSelected = !this.IsSelected;
            }
            else
            {
                if (!this.IsSelected)
                {
                    pageVM.DeselectAllChildren(ParentID);
                    this.IsSelected = true;
                    _isSelectedDone = true;
                }
            }
        }
示例#2
0
        //protected override void OnMouseUp(MouseButtonEventArgs e)
        //{
        //    base.OnMouseUp(e);
        //}
        //protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)
        //{
        //    base.OnPreviewMouseLeftButtonUp(e);
        //}

        #region Public function called bye Move Thumb
        public void OnGroupChildMouseUp()
        {
            DesignerCanvas designer = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(this))) as DesignerCanvas;

            if (designer == null)
            {
                return;
            }
            //e.Handled = false;
            IGroupOperation pageVM      = designer.DataContext as IGroupOperation;
            GroupStatus     groupStatus = pageVM.GetGroupStatus(ParentID);

            if (ClickInitialStatus == GroupStatus.UnSelect && groupStatus == GroupStatus.Selected)
            {
                return;
            }

            //this is option for the group's child widget
            if (groupStatus == GroupStatus.UnSelect)
            {
                //if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                //{
                //    pageVM.SetGroupStatus(ParentID, GroupStatus.Selected);
                //}
                //else
                //{
                //    designer.DeselectAll();
                //    pageVM.DeselectAllGroups();
                //    pageVM.SetGroupStatus(ParentID, GroupStatus.Selected);
                //}
            }
            else if (groupStatus == GroupStatus.Selected)
            {
                if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                {
                    pageVM.SetGroupStatus(ParentID, GroupStatus.UnSelect);
                }
                else
                {
                    designer.DeselectAll();
                    pageVM.DeselectAllGroups();
                    pageVM.SetGroupStatus(ParentID, GroupStatus.Edit);
                    this.IsSelected = true;
                }
            }
            else
            {
                //this is option for the common widget
                if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                {
                    return;
                }
                else
                {
                    if (_isSelectedDone == false)
                    {
                        if (IsSelected == true &&
                            designer.SelectedItems.Count() == 1)
                        {
                            return;
                        }
                        pageVM.DeselectAllChildren(ParentID);
                        this.IsSelected = true;
                    }
                }
            }
        }