Generate fake ManipulationDeltaEventArgs in WPF? - wpf

Is it possible to generate fake ManipulationDeltaEventArgs? I have a touch app which allows users to pinch and zoom images. This works fine, but I'd like them to be able to zoom with buttons instead of pinch and zoom.
Since I have my working code using OnManipulationDelta, is there any way to map scaling using buttons to produce the ManipulationDeltaEventArgs programmatically? I'd then set the scale manipulation to what I want. It doesn't seem to be possible to do this directly but maybe there's some workaround?
Thanks

The correct way would be to create a method that contains the zooming code and call this method from the button click and from OnManipulationDelta.

Related

AngularJs, svg : handle rectangle rotation, drag, resize... easily?

We are working on an angular SPA which allow users to draw elements like rectangle, lines, elipses...
User must be able to rotate, drag, resize all those elements.
For that we use the snap BBox angles, to place some grips, to be able to resize for example.
All grips are so identified as NordWestPoint, NordEastPoint, SouthWestPoint, SouthEastPoint.
This is working fine if we don't use the rotation: drag and resize are working fine.
But as soon as we use rotate, for example to reverse a rectangle upside down, and then try to resize, the NordWestPoint is now in the SouthEastPoint place, and this is a mess, the resize is not working anymore and have some weird behaviour as the positioning functions return wrong results...
Is there any library that we can use, any pattern, any good practice, any example that someone can show to handle that easily?
Thx

WP7 Image panning and zooming

I'm looking for component, that would allow me to show and manipulate single image in a same way as native image browsing in Pictures hub.
I want:
Pinch to zoom image (with top and bottom limits)
Drag to move image around, but I don't want it to get out of bounds of screen. Spongy behavior is optional.
Double tap to toggle between original size and fit-to-screen size.
Does such component exist? Preferably free. If it doesn't, then I need to implement everything myself.

Silverlight MapLayer right click issue

I am currently developing a Silverlight OOB application using the Bing Map Control, however I have come across an issue I am struggling to resolve. Basically I have three map layers:-
Base Map (bottom layer)
Icon / Pushpin layer (middle layer)
Shape / drawing layer (top layer)
This all works fine, I have put mouse right click functionality on each of my icons (pushpins if you prefer), if I add a map polygon or polyline to the top layer and this item happens to cover the same area as one of my icons in the middle layer I can no longer get any of the mouse events to fire on my icon.
If anyone can think of a way I can pass the mouse operations from my top layer objects to the middle layer objects please let me know.
Many thanks in advance
Set the IsHitTestVisible of your top layer to false. I feel I need to type more text here but there really isn't much more to say.
It's not clear from your question if you need both the shape and the icon to get the mouse event.
If all you need is for the icon to get the event, then switch the order of your layers so Icon layer is on top.
If you need both shape and icon to get the event, then (if you keep your order with shapes on top) you would need to have some way to tell what icons a shape covers. Do you have a parent/child releationship between them? If not, can you create one? If you set up an event on the shape, and set up OnEvent handlers for the icons that listen to the events, then you can have the icons react as well.
If you are more clear about what your situation is, I could post some code that could help.

Silverlight Create draggable control over image

I want to build some GUI where an image is presented, and the user should pick nd/or adjust some points (ellipses) according to the image. Basically, like a map control, when we want to mark some points or make a route, but instead of a map, a picture must be presented. The final locations will be used for image processing. Is there a built-in silverlight functionality to do this? How should be the best way?
regards
for the Drag & Drop part, there is no built-in functionality in Silverlight so far (at least not for UIElements). But there are many implementations out there that provide this functionality, e.g. the DragDropManager on Codeplex:
http://silverlightdragdrop.codeplex.com/
These "workarounds" usually use mouse events and CaptureMouse/ReleaseMouseCapture to implement Drag & Drop behavior on UIElements.
Once you have Drag & Drop in your app, the rest should not be too hard. I'd place the image inside a Canvas and then move the markers around on that Canvas using the functionality provided by e.g. the Codeplex Drag & Drop implementation. Basically, all you have to do is set Canvas.Top/Canvas.Left for a marker based on where the mouse is.
Cheers, Alex

zooming in silverlight

I have created a 3D structure(basically an image) dynamically using kit3D.However,I wanted to zoom only a small segment of the whole structure.My entire image is loaded altogather at a time,so I am not considering using deep zoom.
Is there anyway where I can zoom only a part of a dynamically generated image in silverlight??
Thank you,
Ramya
You can use a Scale RenderTransform to increase the size of the image, then use a clip to only show one part of it, thus giving the effect of zoom.
Alternatively you can use a ViewBox from the Silverlight toolkit
I'd use a MultiScaleTileSource for that. It's a callback based system - it requests Deep Zoom tiles from a function you implement when the user zooms or pans.
Here's some sample code, and here's a full working example that pulls map tiles dynamically from Virtual Earth.
This example may be helpful.
there is an example of use silverlight 3 and Virtual Earth on http://www.silverenlightenment.com/

Resources