WPF Scrollviewer PanningMode move Window? - wpf

I have add a ScrollViewer in my WPF4 Window with ScrollViewer.PanningMode.
When I drag scrollviewer on my multitouch screen it's OK. But... the Window move with scroll when I arrive on top scroll or bottom scroll.
How can we avoid this?

Edit: To complete the answer: There is a native event for this which can just be marked as handled: ManipulationBoundaryFeedback
This movement is called boundary feedback which is governed by the operating system (can be set by users in the Pen and Touch settings on the Panning tab). I do not know if the Windows API allows you to prevent it, this page might be relevant.

Related

How to show a WPF window above a TaskBar icon?

In Google's Chrome App Launcher for Windows, does anyone know how they managed to show the window such that it's centered above the application's icon in the TaskBar? Any kind of solution for C#/.NET would be fine (p/invoke, etc.).
I've searched high and low and there are solutions for the System Tray based on identifying the screen rect of a notify icon, but I have not found one for the TaskBar (except one approach that is based on a screen capture, but it's too fragile for production applications).
Thanks!
-Tom B.
Thanks to NETscape's hint, I found that the way that the Chrome App Launcher makes it look like the window is appearing over the TaskBar icon is by checking the mouse position immediately after starting up, and if the mouse is in the TaskBar area then it shows the window directly above the TaskBar and horizontally centered over the mouse.
You can test this by moving the mouse left or right immediately after clicking the icon, in which cases the window appears to the left or right of the TaskBar icon. If you move the mouse outside the TaskBar area right after clicking it (or launch the app from a Desktop icon) then the window is just anchored to the lower-left corner of the screen.

How can I scroll Silverlight pages horizontally with touch gestures (1 finger, up and down)

I have a touchable silverlight application where i want to show information. So I use a ScrollViewer to scroll down or up, but the handling is not the best because it is hard to hit the scrollviewer, so i want to scroll down and up also with finger gestures like we now it from the iPhone.
My first idea was to implement a class which is derived from ScrollViewer, but thanks to Microsoft who sealed the ScrollViewer class in Silverlight, so i can't use this method.
I have heard about Touch.FrameReported (http://msdn.microsoft.com/en-us/library/dd894494(v=vs.95).aspx), but i can't find an example for silverlight pages how to use it. I don't use canvas as in the link.
Has somebody an idea how to use it or another method to scroll with touch gestures? i only need it for 1 finger gesture to scroll pages.
Every suggestion is welcome!

MouseLeftButtonUp Alternative - Windows Mobile

Is there any other sensible way where I can fire a touch event on a Windows Mobile App?
I have a Hangman game. I have a bunch of images which are the alphabet.
I've put all of the images inside a Scroll Viewer so the user can scroll through the list.
As a precaution, I've set the click event to MouseLeftButtonUp because if I set it to "Down", it will trigger the image code when really, the user just wanted to scroll.
However, even with MouseLeftButtonUp, I've still got the same problem. When I test it, it scrolls but if the finger is still on the same image and if I release my finger, it'll fire off the code behind that image...
How can I overcome this problem? I hope my situation makes clear sense.
Perhaps you want to use touch events rather than mouse events since Windows mobiles devices are designed for touch rather than mouse clicking.

WinForms Touchpad Scrolling

I'm working on a winforms application meant for touchpads and would like the user to be able to scroll through the contents by swiping their finger across the screen. I see that windows (at least windows 7) has this behavior built in for any scrollable control. However the control I'm trying to scroll is a third party control that went ahead and made its own scrollbar elements, so this built in behavior is lost.
I could get the same behavior by placing that third party control in a panel, and letting that panel handle the scrolling. However when the user swipes on that control, its containing panel doesn't hear those events and scrolling never takes place.
Are they any resources on how windows handles touchpad scrolling, or how I could make a panel respond to touchpad swipes when the cursor is inside one of its child controls?

Determining location of tray icon

My application is designed to sit in the system tray and behave similarly to the Network/Volume/Power/Action Centre tray items in Windows 7 (and the equivalent items in Windows Vista). That is, it becomes visible when the tray icon is clicked, and becomes hidden when focus is lost.
The application is written in WPF, but I am currently using NotifyIcon from WinForms for the tray icon.
I would like to know if anyone has any suggestions as to how I might determine the position (i.e. screen coordinates) of my application's tray icon. The default Windows Vista/7 tray items have some way of doing this, since the pop-out windows are centre-aligned above the relevant tray icon.
In Vista this wasn't much of an issue: I had the application permanently set to the bottom-right corner, and this looked fine (though there was no logic included for cases when the taskbar wasn't placed at the bottom of the screen). However, in Windows 7 my application ends up obscuring the new system tray pop-out box, rather than hovering above it like the volume controls, etc., do.
The best solution I've seen in my searches so far is to handle the mouse-up event on the NotifyIcon and use the mouse coordinates to determine the position of the icon. I think I'll end up using this method if unless someone has a better idea, though it's not ideal as the position will vary slightly depending on where within the icon the user clicks.
Windows 7 and higher expose the Shell_NotifyIconGetRect() function, which returns the screen coordinates of the icon's bounding rectangle.
You'll need to provide it the notify icon GUID, though, and I don't know if you can access that property through the managed NotifyIcon class.
Further to this, I've written about a method to find the location of a notify icon when the Shell_NotifyIconGetRect function is not available: http://blog.quppa.net/2010/12/28/windows-7-style-notification-area-applications-in-wpf-part-6-notify-icon-position-pre-windows-7/

Resources