mouse/tap events in Silverlight - c#

I am using C#, Silverlight, WP7.
What is the difference between a Tap event and the sequence of MouseLeftButtonDown and MouseLeftButtonUp events? Also why doesn't a Tap event always trigger MouseLeftButtonDown/MouseLeftButtonUp in sequence? Are these events any different in simulation on the computer and deployed on a phone?
I can't find this in the documentation and my own tests seem to imply that a really quick click on the screen won't always generate a MouseLeftButtonDown/MouseLeftButtonUp sequence. Are these mutually exclusive events? If not, what is the order of events?
Thanks in advance.

Although the mouse events are available on WP7, they are not necessarily reliable.
User input in Windows Phone includes manipulation events, mouse
events, and touch events.
Manipulation events are the recommended way to handle user input. Unless you have a specific need, you should avoid using mouse events
in your Silverlight applications for Windows Phone for performance and
hardware compatibility reasons. Instead, you should use manipulation
events. You can also use Tap, DoubleTap, and Hold events on any
elements that derive from UIElement such as the base controls.
http://msdn.microsoft.com/en-us/library/ff967560%28v=VS.92%29.aspx

Related

Can I render a WPF window with buttons on a touch sensitive screen and read the input? Suggestions?

I want to create a WPF window that will display on a touch sensitive screen and the window contains 80 buttons. I want my WPF app to recognize tabs on specific buttons. Do I need any specific API to do that or how will the tabs on the touch sensitive screen be transmitted to my WPF app?
Any suggestions?
Thanks
Windows 7 and its higher versions have the ability to receive input from multiple touch-sensitive devices. WPF applications can also handle touch input as other input, such as the mouse or keyboard, by raising events when a touch occurs.
WPF exposes two types of events when a touch occurs − touch events and manipulation events. Touch events provide raw data about each finger on a touchscreen and its movement. Manipulation events interpret the input as certain actions. Both types of events are discussed in this section.
WPF enables applications to respond to touch. For example, you can interact with an application by using one or more fingers on a touch-sensitive device, such as a touchscreen This walkthrough creates an application that enables the user to move, resize, or rotate a single object by using touch.
Source MSDN : https://msdn.microsoft.com/en-us/library/ee649090.aspx
Also read this codeproject article - http://www.codeproject.com/Articles/692286/WPF-and-multi-touch
WPF applications work on the touch screen without any needs for modifications. Of course you can add support for gestures like pinch-zooming etc. but tapping on buttons works out of the box. For the WPF application it doesn't matter if user is tapping with the finger or clicking with the mouse.

How replace mouse events with Multipoint events

I have a WPF application that uses one -ordinary- mouse but I wanna allow multi user with multi mouse to use it.
I installed Microsoft Multipoint Sdk and configured it.
But How I can use Sdk events instead of user32.dll events?
I don't think you need that.
Look into the MouseEventArgs. They all have a MouseDevice property to see which mouse caused the event.

What is the difference between tap , mouse left button down and mouse pressed events?

Well, I am developing a windows phone app in c# and xaml.
I found these 3 events similar to each other.
the tap event, mouse left button down event and mouse pressed events.
Can anyone tell what exactly is the difference does these 3 events make when the phone is just a touch screen phone. What is unique difference between these 3 events ???..
Thanks..
If you down vote this question then tell atleast what is wrong in my question by comments..Sorry if this is too silly question.
This QuickStart Touch Input for Windows Phone page on MSDN, and this MouseLeftButtonUp Event page and this Mouse Position page explain the differences between the different events.
Basically, as per the links:
Tap
A finger touches the screen and releases.
MouseLeftButton
Is triggered in on finger release within the Tap event.
MousePressed
Mouse Pressed is the state of the tap while in Tap.
So the events are linked together of sorts. Someone with more experience with Windows Phone programming may be able to provide a better or more accurate explanation.
For all practical purposes, the Tap and Click events are equivalent for a Button.
The Click event was originally defined in Silverlight for desktop Windows and it is only defined for the Button control (and derivatives such as HyperlinkButton). You can think of the Click event as the "traditional" way to handle a Button press.
The Tap event was added to the framework in Windows Phone 7.1 (Mango). Tap is defined in the UIElement class, which is the parent of many types of controls. You can handle a Tap event in a TextBlock, Image, and many other controls. Button is subclassed from UIElement as well, and thus can also receive Tap events. It is redundant that a Button can receive both Tap and Click events.
reference
if u also read the second answer u can get some more info

How do I implement touch event for my application?

I want to implement touch event in my Win-Form application. Touch events for buttons, list, combo box and check box. Any idea how do I implement it ? I couldn't find any resources for the same.
I just want my application to be completely compatible with the touch screen Tablets. I use .NET 3.5 and don't see any relevant event handlers. Am I missing any thing ?
I think you are missing something.
I think the "touch" event you are looking for is in fact a "single click" if running win forms on a tablet.
Handle the OnClick event.
You can do so by using Selecting event handler dor respective controls

Wpf hosting windows form - mouse events not getting through

I've got a WPF app that has a WindowsFormsHost, which hosts a geobase map.
The problem I have is getting the mouse events through to the map. I've added MouseUp event handlers to the map (in code), but this does not work, and I've tried adding the MouseUp event handler on the Grid that contains the WindowsFormsHost, but the events are not picked up by this either.
I'm not sure whether this is a general WPF problem with the way I'm handling events, or a more specific problem that is specific to hosting Windows Forms apps in WPF...
Any pointers would be appreciated :)
As far as I understand you need to call WindowsFormsHost.EnableWindowsFormsInterop() for events to be forwarded to your winforms code.

Categories

Resources