WPF Flick along a path (Surface) - wpf

Im developing an app for Microsoft Surface and Im trying to make the most of the libraries that are out there, the functionality Im after if to be able to flick a UI element.
The ScatterView control makes this easy, but I would like to restrict the UI element to only be able to be flicked along a set path. This is where Im having trouble.
So my questions are:
1) Can you restrict a ScatterViewItem to only be flicked along a path?
2) If not, how would you implement a flick gesture to flick a UI element along a set path?
Thanks!
Mark

1) Not that I know of, and this probably isn't the best way to approach it.
2) Assuming you have the object you want flicked and the path at design-time, I've previously implemented dragging and flicking along a path by creating a timeline animation that represents the movement across the entire path. At runtime, I capture contacts on that object, feed them to a Affine2DManipulationProcessor, and seek the animation based on the manipulation events.
So in my case I was creating a drawer. When the user touched the drawer, I start the animation and pause it immediately. If the user drags it open, I seek the animation the appropriate amount forward based on how far the manipulation processor tells me they've moved.
To get the flick behavior, you just hand off the manipulation to the Affine2DInertiaProcessor and continue handling the delta events.
This all works surprisingly well.

Related

Loop video file placed in interactive pdf

I have an interactive pdf document that is displayed fullscreen. there's a navigation bar that users can press to jump to different pages.
What I need is some sort of looping screensaver (a collection of photos) that can be enabled by the user pressing a button.
I considered dropping in a video of a slideshow that I made in after effects, until I realised it's not that easy to loop the playback of that video!
How can I loop a video that I have placed onto a page in a pdf? I've read somewhere about swf's looping but I've tried that and there's no loop option when I place the file in acrobat?
Can someone give me some advice as I thought it would be pretty straightforward to loop a video and now it's looking far from easy.
Thanks
If it is just a slide show, meaning changing images at regular intervals, a few things could be done with Acrobat/Reader's on-board means.
In Full Screen, Acrobat allows to cycle through pages every whatever second. A button on those "screensaver" pages would get back to a "real" page. The question is whether that would interfere with the rest of the document.
Another approach would be having a Button field, icon only, read-only, no action, where you would show an image (preferably PDF) as an icon, and have a control loop running (using interval, timeout) loading different icons. This could be implemented with quite little JavaScript.

Can I create a motion colorizing pixel shader in WPF?

I have a video playing of lines being drawn on the screen. Is it possible to create a pixel shader (for WPF) that turns newly colored pixels a certain color for N milliseconds?
That way, there can be some indication to the user to movement on the screen when the lines don't move often and the user isn't always looking at the screen.
You can use DirectShow. Its written in unmanaged code, so you need to use this wrapper DirectShow.NET in order to use it in your C# application which is running in managed environment (samples are included, even with EVR which stands for Enhanced video Renderer which means MUCH better video quality). And when you will be passing a control handle to wrapper method for setting the video output, you need a WinForms control, because only from them you can get your desired control handle. That WinForms control you can then host in your WPF application using the WindowsFormsHost control provided for such situations when you need to use some WinForms control(s) in a WPF application. Its just theory, so i dont know if its an ultimate solution for you.
BTW: The whole idea is based on fact, that DirectShow is just some query constructed from separated filters. Renderer is a filter (EVR, VMR-7, VMR-9). Sound player is a filter. And they are connected through their pins. Its like a diagram. Electronic schema or something like that. And you can put for example Grey scale filter in there. And voila, video output will be greyscale. There is a bunch of tutorials for that. And completed simple filters as well. Unfortunately, filters must be written in C++:(
PS: I never said its gonna be easy:D

Shell Integration Library WindowChrome with Drop Shadow

Ive been googling this alot but can't find any working solution. Im using Shell Integration Library to cerate custom Window Chrome and I also need drop shadows for this window. Some say setting GlassFrameThickness to -1 do the trick but its not working for me. And Jeremiah Morrill suggested using DwmExtendFrameIntoClientArea. Ive tried that and it works, sort of. The shadows looks ok but when the window is shown it is first shown as a glass-frame and then a second later the real content is superimposed. This causes to much flickering for me. Is there any way to get rid of this flickering or is there any better way using only Shell Integration Library?
I had a similar problem where it wouldn't display any shadow when using a custom chrome. It worked fine when using the glass.
I got a shadow by setting GlassFrameThickness="0,0,0,1". The glass didn't show and I got the shadow.
Be warned, the shadow is a simple RECT to Windows, so if you have a funky chrome with transparencies it may look funny.
Also if you support the maximized state be aware the you'll need to set a margin on your top-level panel element of "8,8,8,8" when in maximized mode. All other modes should be "0,0,0,0".
To alimbada, the WindowStyle defaults to None on custom chrome.
The Shell Integration Library uses DwmExtendFrameIntoClientArea, plus handling of several Window messages to get the effects. If you're using the full window rect (i.e. no rounded corners) then setting it to (0,0,0,1) as suggested will give you the drop shadows as you want. If you want to simulate the rounded corners of Aero, then setting it to (8,8,8,8) will extend the glass frame enough that the corners also stay rounded, and then you're responsible for not drawing over the corners of the rectangle. The shape of the drop shadow doesn't change regardless of the glass frame thickness.
The flashing you're seeing when setting the thickness to -1 still exists even when not fully extending the glass frame. What's happening is the window is getting shown while the content is still compositing. What you can do is simplify the default UI so it displays quicker (or you can stage it, bringing in a simnple background first and then replacing it with something usable), or you can create and show the window off-screen, and then move it to the desired start location once the content has been rendered. The easy way to detect when it's probably ready is to invoke a DispatchTimer with Priority=Loaded. That should only get invoked once the basic first layout has been completed.

Smooth Video Transitions for WPF

I'm using VB.net 2010 and WPF 4. I need to have a smooth transition between two videos played on the mediaelement. I absolutely cannot use anything that requires me to use a winhost in the WPF window, as that will make my project impossible (since the video is full screen, and the controls are over the video)
Basically, I need for the video to play through, and then smoothly go to another video specified in code behind. I cannot splice the two videos together - they must be separate.
How do I have the videos transition smoothly, with no "blink"?
I'm guessing without testing here. You're probably going to need some CPU cores and a good video card.
If you have the memory, use two MediaElements.
Queue up both videos, one on each element.
Set the opacity of the second one to completely transparent. They're UIElements so this should work...
Use timers of some kind keyed from the start of playback on the first one so that you get an event a couple of seconds before playback ends.
With that event delegate, start the video in the second MediaElement, animate the first one's opacity to zero while simultaneously animating the second one to fully opaque.
If you need to do it again, set up the timer again and make sure your delegate animates things the other way.

Custom scroll layout with fisheye in WPF

I know Windows Forms quite good but I'm new to WPF.
I'd like to create application similar to RSS reader - in main window every note will be displayed in Post-it like frame and all notes should be chained and scrollable up and down. I also want to include kind of fisheye view - single note will be displayed full size in the centre of the screen and will shrink and rotate on the edge.
I know custom control, transformation and databinding concepts but I'm not sure how to handle displaying and scrolling notes in the main window. The questions are:
what is the suggested way to arrange, display and scroll ordered chain of notes?
should single note discover own position on the screen or it should be notified by it's container?
how in such solution provide feature which will open related notes as a "multiple popups" notes connected by a line with original one? (like traversing correlated results in Google Wonder Wheel, adobe flash there)
are there any standard solutions for displaying and manipulating (moving, attaching, collapsing) such popup-widgets?
If there are any similarities in your proposal to other GUI frameworks (Forms, Swing, SWT), comparison are welcome too.
Thanks in advance!
It seems to me you are describing a "carousel control" or "element flow" or "cover flow". I've put some links at this answer.

Resources