コード例 #1
0
ファイル: RepeaterItem.cs プロジェクト: zyj0021/ModernWpf
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            if (SelectionModel != null)
            {
                if (Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) && !SelectionModel.SingleSelect)
                {
                    if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
                    {
                        SelectionModel.DeselectRangeFromAnchor(RepeatedIndex);
                    }
                    else
                    {
                        SelectionModel.SelectRangeFromAnchor(RepeatedIndex);
                    }
                }
                else if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
                {
                    if (SelectionModel.IsSelected(RepeatedIndex).Value)
                    {
                        SelectionModel.Deselect(RepeatedIndex);
                    }
                    else
                    {
                        SelectionModel.Select(RepeatedIndex);
                    }
                }
                else
                {
                    SelectionModel.Select(RepeatedIndex);
                    this.Focus();
                }
            }

            base.OnMouseLeftButtonDown(e);
        }