This is a migrated thread and some comments may be shown as answers.

ABout SetShouldSuspendMousePromotion

3 Answers 142 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pablo
Top achievements
Rank 1
Pablo asked on 27 Feb 2021, 03:29 AM
Hello, i downloading demo of software and start a new emptyu project in order to start to test.
The first feature i like of telerik is apparently can prevent muse promotion n touch event.

I create this code, but not work:

amespace TelerikWpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Telerik.Windows.Input.Touch.TouchManager.IsEnabled = true;
            Telerik.Windows.Input.Touch.TouchManager.IsTouchEnabled = true;
            Telerik.Windows.Input.Touch.TouchManager.SetShouldSuspendMousePromotion(this, true);
        }


    }
}


I run this empty app, and mouse promotion wont stop.
Why?
What I doing wrong?

3 Answers, 1 is accepted

Sort by
0
Pablo
Top achievements
Rank 1
answered on 27 Feb 2021, 04:03 AM
I start think the touch event not is handled or something is wrong but i just add a messagebox for check if touch happens, and yes event is there, but mouse promotion continue and not is suspended. Why?


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Input.Touch;

namespace TelerikWpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Telerik.Windows.Input.Touch.TouchManager.IsEnabled = true;
            Telerik.Windows.Input.Touch.TouchManager.SetShouldSuspendMousePromotion(this, true);
            Telerik.Windows.Input.Touch.TouchManager.AddTouchDownEventHandler(this, this.TouchDown);

        }




        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
     
        }
       public void TouchDown(object sender,  Telerik.Windows.Input.Touch.TouchEventArgs  e)
        {
            e.Handled = true;

            MessageBox.Show("Touched!");
        }



    }
}
0
Pablo
Top achievements
Rank 1
answered on 27 Feb 2021, 04:04 AM
I touch any part of the windows and touch event is there, but if touch any part of the window, tpuch promote the mouse event, and mouse pointer is moved under my finger.
0
Martin Ivanov
Telerik team
answered on 03 Mar 2021, 03:23 PM

Hello Pablo,

The ShouldSuspendMousePromotion suspends only mouse events. However, the mouse cursor will still move when you touch on a tablet or a monitor that supports cursors. This behavior is Windows OS based on there is no WPF API that allows changing this behavior. This is why the Telerik TouchManager doesn't suspend the mouse cursor moving. 

I hope this answers your question.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Pablo
Top achievements
Rank 1
Answers by
Pablo
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or