Beispiel #1
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            if (!e.Handled)
            {
                var indexPath = GetIndexPath();
                Debug.WriteLine("OnPointerPressed:" + indexPath.ToString());

                if (SelectionModel != null)
                {
                    if (Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) && !SelectionModel.SingleSelect)
                    {
                        if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
                        {
                            SelectionModel.DeselectRangeFromAnchorTo(GetIndexPath());
                        }
                        else
                        {
                            SelectionModel.SelectRangeFromAnchorTo(GetIndexPath());
                        }
                    }
                    else if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
                    {
                        var path = GetIndexPath();
                        if (SelectionModel.IsSelectedAt(path).Value)
                        {
                            SelectionModel.SelectAt(path);
                        }
                        else
                        {
                            SelectionModel.SelectAt(path);
                        }
                    }
                    else
                    {
                        SelectionModel.SelectAt(GetIndexPath());
                        this.Focus();
                    }
                }

                e.Handled = true;
                base.OnMouseLeftButtonDown(e);
            }
        }