// Token: 0x0600513F RID: 20799 RVA: 0x0016C9F0 File Offset: 0x0016ABF0
        private void MakeToggleSelection(ListBoxItem item)
        {
            bool value = !item.IsSelected;

            item.SetCurrentValueInternal(Selector.IsSelectedProperty, BooleanBoxes.Box(value));
            this.UpdateAnchorAndActionItem(base.ItemInfoFromContainer(item));
        }
예제 #2
0
        private void MakeToggleSelection(ListBoxItem item)
        {
            bool select = !item.IsSelected;

            item.SetCurrentValueInternal(IsSelectedProperty, BooleanBoxes.Box(select));

            UpdateAnchorAndActionItem(ItemInfoFromContainer(item));
        }
예제 #3
0
        internal void NotifyListItemClicked(ListBoxItem item, MouseButton mouseButton)
        {
            // When a ListBoxItem is left clicked, we should take capture
            // so we can auto scroll through the list.
            if (mouseButton == MouseButton.Left && Mouse.Captured != this)
            {
                Mouse.Capture(this, CaptureMode.SubTree);
                SetInitialMousePosition(); // Start tracking mouse movement
            }

            switch (SelectionMode)
            {
            case SelectionMode.Single:
            {
                if (!item.IsSelected)
                {
                    item.SetCurrentValueInternal(IsSelectedProperty, BooleanBoxes.TrueBox);
                }
                else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {
                    item.SetCurrentValueInternal(IsSelectedProperty, BooleanBoxes.FalseBox);
                }

                UpdateAnchorAndActionItem(ItemInfoFromContainer(item));
            }
            break;

            case SelectionMode.Multiple:
                MakeToggleSelection(item);
                break;

            case SelectionMode.Extended:
                // Extended selection works only with Left mouse button
                if (mouseButton == MouseButton.Left)
                {
                    if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == (ModifierKeys.Control | ModifierKeys.Shift))
                    {
                        MakeAnchorSelection(item, false);
                    }
                    else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                    {
                        MakeToggleSelection(item);
                    }
                    else if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                    {
                        MakeAnchorSelection(item, true);
                    }
                    else
                    {
                        MakeSingleSelection(item);
                    }
                }
                else if (mouseButton == MouseButton.Right)     // Right mouse button
                {
                    // Shift or Control combination should not trigger any action
                    // If only Right mouse button is pressed we should move the anchor
                    // and select the item only if element under the mouse is not selected
                    if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == 0)
                    {
                        if (item.IsSelected)
                        {
                            UpdateAnchorAndActionItem(ItemInfoFromContainer(item));
                        }
                        else
                        {
                            MakeSingleSelection(item);
                        }
                    }
                }

                break;
            }
        }
예제 #4
0
        private void MakeToggleSelection(ListBoxItem item)
        {
            bool select = !item.IsSelected;

            item.SetCurrentValueInternal(IsSelectedProperty, BooleanBoxes.Box(select));

            UpdateAnchorAndActionItem(ItemInfoFromContainer(item));
        }
예제 #5
0
        internal void NotifyListItemClicked(ListBoxItem item, MouseButton mouseButton)
        {
            // When a ListBoxItem is left clicked, we should take capture
            // so we can auto scroll through the list.
            if (mouseButton == MouseButton.Left && Mouse.Captured != this)
            {
                Mouse.Capture(this, CaptureMode.SubTree);
                SetInitialMousePosition(); // Start tracking mouse movement
            }

            switch (SelectionMode)
            {
                case SelectionMode.Single:
                    {
                        if (!item.IsSelected)
                        {
                            item.SetCurrentValueInternal(IsSelectedProperty, BooleanBoxes.TrueBox);
                        }
                        else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                        {
                            item.SetCurrentValueInternal(IsSelectedProperty, BooleanBoxes.FalseBox);
                        }

                        UpdateAnchorAndActionItem(ItemInfoFromContainer(item));
                    }
                    break;

                case SelectionMode.Multiple:
                    MakeToggleSelection(item);
                    break;

                case SelectionMode.Extended:
                    // Extended selection works only with Left mouse button
                    if (mouseButton == MouseButton.Left)
                    {
                        if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == (ModifierKeys.Control | ModifierKeys.Shift))
                        {
                            MakeAnchorSelection(item, false);
                        }
                        else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                        {
                            MakeToggleSelection(item);
                        }
                        else if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                        {
                            MakeAnchorSelection(item, true);
                        }
                        else
                        {
                            MakeSingleSelection(item);
                        }
                    }
                    else if (mouseButton == MouseButton.Right) // Right mouse button
                    {
                        // Shift or Control combination should not trigger any action
                        // If only Right mouse button is pressed we should move the anchor
                        // and select the item only if element under the mouse is not selected
                        if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == 0)
                        {
                            if (item.IsSelected)
                                UpdateAnchorAndActionItem(ItemInfoFromContainer(item));
                            else
                                MakeSingleSelection(item);
                        }
                    }

                    break;
            }
        }
        // Token: 0x0600513B RID: 20795 RVA: 0x0016C83C File Offset: 0x0016AA3C
        internal void NotifyListItemClicked(ListBoxItem item, MouseButton mouseButton)
        {
            if (mouseButton == MouseButton.Left && Mouse.Captured != this)
            {
                Mouse.Capture(this, CaptureMode.SubTree);
                base.SetInitialMousePosition();
            }
            switch (this.SelectionMode)
            {
            case SelectionMode.Single:
                if (!item.IsSelected)
                {
                    item.SetCurrentValueInternal(Selector.IsSelectedProperty, BooleanBoxes.TrueBox);
                }
                else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {
                    item.SetCurrentValueInternal(Selector.IsSelectedProperty, BooleanBoxes.FalseBox);
                }
                this.UpdateAnchorAndActionItem(base.ItemInfoFromContainer(item));
                return;

            case SelectionMode.Multiple:
                this.MakeToggleSelection(item);
                return;

            case SelectionMode.Extended:
                if (mouseButton != MouseButton.Left)
                {
                    if (mouseButton == MouseButton.Right && (Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == ModifierKeys.None)
                    {
                        if (item.IsSelected)
                        {
                            this.UpdateAnchorAndActionItem(base.ItemInfoFromContainer(item));
                            return;
                        }
                        this.MakeSingleSelection(item);
                    }
                    return;
                }
                if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == (ModifierKeys.Control | ModifierKeys.Shift))
                {
                    this.MakeAnchorSelection(item, false);
                    return;
                }
                if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {
                    this.MakeToggleSelection(item);
                    return;
                }
                if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                {
                    this.MakeAnchorSelection(item, true);
                    return;
                }
                this.MakeSingleSelection(item);
                return;

            default:
                return;
            }
        }