Exemplo n.º 1
0
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            if (e.Source == _presenter)
            {
                var point = e.GetPosition(_presenter);
                var index = CaretIndex = _presenter.GetCaretIndex(point);
                var text  = Text;

                switch (e.ClickCount)
                {
                case 1:
                    SelectionStart = SelectionEnd = index;
                    break;

                case 2:
                    if (!StringUtils.IsStartOfWord(text, index))
                    {
                        SelectionStart = StringUtils.PreviousWord(text, index, false);
                    }

                    SelectionEnd = StringUtils.NextWord(text, index, false);
                    break;

                case 3:
                    SelectionStart = 0;
                    SelectionEnd   = text.Length;
                    break;
                }

                e.Device.Capture(_presenter);
                e.Handled = true;
            }
        }
Exemplo n.º 2
0
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            var point = e.GetPosition(this);
            var index = this.CaretIndex = this.GetCaretIndex(point);
            var text  = this.Text;

            switch (e.ClickCount)
            {
            case 1:
                this.SelectionStart = this.SelectionEnd = index;
                break;

            case 2:
                if (!StringUtils.IsStartOfWord(text, index))
                {
                    this.SelectionStart = StringUtils.PreviousWord(text, index, false);
                }

                this.SelectionEnd = StringUtils.NextWord(text, index, false);
                break;

            case 3:
                this.SelectionStart = 0;
                this.SelectionEnd   = text.Length;
                break;
            }

            e.Device.Capture(this);
        }
Exemplo n.º 3
0
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            e.Device.Capture(this);
            this.lastPoint = e.GetPosition(this);

            var ev = new VectorEventArgs
            {
                RoutedEvent = DragStartedEvent,
                Vector      = (Vector)this.lastPoint,
            };

            this.RaiseEvent(ev);
        }