Пример #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;
            }
        }
Пример #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);
        }
Пример #3
0
        /// <inheritdoc/>
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            base.OnPointerPressed(e);

            if (e.MouseButton == MouseButton.Left)
            {
                e.Handled = UpdateSelectionFromEventSource(e.Source);
            }
        }
Пример #4
0
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            if (!IsDropDownOpen)
            {
                if (((IVisual)e.Source).GetVisualAncestors().Last().GetType() != typeof(PopupRoot))
                {
                    IsDropDownOpen = true;
                }
            }

            base.OnPointerPressed(e);
        }
Пример #5
0
        /// <summary>
        /// Called when the pointer is pressed anywhere on the window.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event args.</param>
        private void TopLevelPreviewPointerPress(object sender, PointerPressEventArgs e)
        {
            if (IsOpen)
            {
                var control = e.Source as ILogical;

                if (!this.IsLogicalParentOf(control))
                {
                    Close();
                }
            }
        }
Пример #6
0
        /// <inheritdoc/>
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            base.OnPointerPressed(e);

            PseudoClasses.Add(":pressed");
            e.Device.Capture(this);
            e.Handled = true;

            if (ClickMode == ClickMode.Press)
            {
                RaiseClickEvent();
            }
        }
Пример #7
0
        /// <inheritdoc/>
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            base.OnPointerPressed(e);

            if (e.MouseButton == MouseButton.Left || e.MouseButton == MouseButton.Right)
            {
                e.Handled = UpdateSelectionFromEventSource(
                    e.Source,
                    true,
                    (e.InputModifiers & InputModifiers.Shift) != 0,
                    (e.InputModifiers & InputModifiers.Control) != 0);
            }
        }
Пример #8
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);
        }
Пример #9
0
        private void PointerPressedOutside(object sender, PointerPressEventArgs e)
        {
            if (!StaysOpen)
            {
                var root = ((IVisual)e.Source).GetVisualRoot();

                if (root != this.PopupRoot)
                {
                    Close();
                    e.Handled = true;
                }
            }
        }
Пример #10
0
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            IVisual source     = (IVisual)e.Source;
            var     selectable = source.GetVisualAncestors()
                                 .OfType <ISelectable>()
                                 .OfType <Control>()
                                 .FirstOrDefault();

            if (selectable != null)
            {
                var container = this.ItemContainerGenerator.GetItemForContainer(selectable);

                if (container != null)
                {
                    this.SelectedItem = container;
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Called when the pointer is pressed over the <see cref="MenuItem"/>.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            base.OnPointerPressed(e);

            if (!HasSubMenu)
            {
                RaiseEvent(new RoutedEventArgs(ClickEvent));
            }
            else if (IsTopLevel)
            {
                IsSubMenuOpen = !IsSubMenuOpen;
            }
            else
            {
                IsSubMenuOpen = true;
            }

            e.Handled = true;
        }
Пример #12
0
        /// <inheritdoc/>
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            if (!IsDropDownOpen && ((IVisual)e.Source).GetVisualRoot() != typeof(PopupRoot))
            {
                IsDropDownOpen = true;
                e.Handled      = true;
            }

            if (!e.Handled)
            {
                if (UpdateSelectionFromEventSource(e.Source))
                {
                    _popup?.Close();
                    e.Handled = true;
                }
            }

            base.OnPointerPressed(e);
        }
Пример #13
0
        protected override void OnPointerPressed(PointerPressEventArgs e)
        {
            if (!IsDropDownOpen)
            {
                if (((IVisual)e.Source).GetVisualAncestors().Last().GetType() != typeof(PopupRoot))
                {
                    IsDropDownOpen = true;
                    e.Handled      = true;
                }
            }

            if (!e.Handled)
            {
                if (UpdateSelectionFromEventSource(e.Source))
                {
                    e.Handled = true;
                }
            }

            base.OnPointerPressed(e);
        }
Пример #14
0
 /// <inheritdoc/>
 protected override void OnPointerPressed(PointerPressEventArgs e)
 {
     // Ignore pointer presses.
 }
Пример #15
0
 /// <inheritdoc/>
 protected override void OnPointerPressed(PointerPressEventArgs e)
 {
     base.OnPointerPressed(e);
     e.Handled = true;
 }
Пример #16
0
 /// <summary>
 /// Handle mouse down to handle selection.
 /// </summary>
 protected override void OnPointerPressed(PointerPressEventArgs e)
 {
     base.OnPointerPressed(e);
     LeftMouseButton = true;
     _htmlContainer?.HandleLeftMouseDown(this, e);
 }