I am developing UWP application. In one scenario, I am having multiple ListView on a canvas and I want to perform Drag and Drop between ListViews. While performing Drag-Drop scroller doesn't moves.
I tried to implement Behaviour defined in this Link. But it is not working as PreviewDragOver event is not available in UWP.
Is there any way to implement it ?
While PreviewDragOver is not available in UWP, the DragOver event definitely is. It seems it should be possible to use this event in the attached behavior instead.
Related
Is there a way to get mouse and/or touch events on UI elements using Xamarin Forms? So far I only found the TapGestureRecognizer class, but I want the user to be able to move UI elements (PanGestureRecognizer?) but I haven't been able to locate anything that could help me achieve that.
I am looking for a cross-platform solution if possible (hence the user of Xamarin Forms) but I am ok with creating a platform-specific component that integrates with Xamarin Forms (e.g., I already created a custom base page class to add an iOS-specific background gradient page).
I suggest you give MR Gestures a look. It's a Xamarin.Forms component that adds very robust support for gestures. It works on all Xamarin.Forms platforms. From the website:
MR.Gestures adds Down, Up, Tapping, Tapped, DoupleTapped, LongPressing, LongPressed, Panning, Panned, Swiped, Pinching, Pinched, Rotating and Rotated events to each and every layout, cell and view and to the ContentPage. These events will be raised when the user performs the corresponding touch gesture on the element.
It is not free, but at €10 it's a bargain. The documentation is great and the library works exactly as advertised.
I have a somewhat unusual design problem in a WPF touch application.
I have a UserControl that holds an image, which I allow the user to freely move, resize, and rotate around the touch surface using multitouch by setting:
isManipulationEnabled = true
and then hooking up events for ManipulationStarting, ManipulationDelta, and ManipulationCompleted.
This is all good and works perfectly, but now I would like to add the ability for a user to drag this control into the WrapPanel on another control, which has a list of image files, and add this image to the list.
I tried using DragDrop events by calling DragDrop.DoDragDrop() on the ManipulationDelta event, but it locks the UI and the control until a drop occurs, which is not what I want.
Is there any way to properly do this without writing my own hit-testing code? I'm using WPF 4.0 and .NET 4.5 on VS 2013, and I'm not sure if the Surface SDK would help me in this case (nor could I properly install/load it to VS2013)
Found my solution: Use VisualTreeHelper.HitTest and call the HitTest in the event handler for ManipulationDelta, and then use your own logic for handling the drag over operation. Use ManipulationCompleted event to check the hit test again to complete the drop
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
I have implemented MouseDragElementBehavior to my application before but unfortunately I use the application now using touch panel.
Before, obviously I drag using the mouse, but now because I am using touch panel, the MouseDragElementBehavior won't work.
Is there a way to convert this? My only changes to my application is by using Touch Panel and no changes to my application at all.
The rest like what a mouse can do is also doable by touching but dragging is not supported.
Please help. Thanks
There currently isn't any official Drag for touch. You can however create your own thouch event for such by responding and combining touch events.
PreviewTouchDown For starting your own start drag function on element so add the TouchMove event here to the object
TouchMove For dragging the object visual
PreviewTouchUp For stop dragging stop the TouchMove event here
TouchEnter Check if the object you entered accept drops
Or you can of course google for libraries that already implemented this kind of behavior.
I have googled it a bit and found a good walktrought for windows applications.
And with the Touch Class you can get all the touch points in the application (multiple fingers) and implement your own behavior.
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.