c# - How do you do transition effects using the Frame control in WPF? -


I thought it would be easy, but I do not think so.

I have two pages that are loaded in my frame control I want to be able to either have a good slide effect from one page to the next or a simple fade-effect.

It can not be found anywhere on the Internet.

Update 1 The accepted answer is good, but I got a better one here.

Update 2 If you can assume that I have found a better solution

There is a similar problem discussed here: Take control of your frame when you navigate to a new page using the techniques described here. This kind of smell:

xaml:

  ... frame name = "navigating" frames = "frames_ navigating" & gt; ...  

code:

  ... private bool _allowDirectNavigation = false; Private NavigatingCancellAventArge _navArgs = null; Private period _duration = New period (timespace.formsconds (1)); Private double _old heights = 0; Private Zero Frame_Navigation (Object Sender, NavigatingConselEventErguesE) {If (content! = Null & amp;; _allowDirectNavigation) {E.Canel = true; _navArgs = e; _oldHeight = frame Actualheart; Double animation animation = new double animation (); Animation0.frame = frames.realistichete; Animation 0 to = 0; Animation 0. Period = _duration; Animation 0. Contains + = slides full; Frame Beginning animation (height property, animation 0); } _allowDirectNavigation = false; } Private Zero Slide Complete (Object Sender, EventArgs e) {_allowDirectNavigation = true; Switch (_navArgs.NavigationMode) {Case NavigationMode.Now: if (_navArgs.Uri == zero) frame. Navigate (_navArgs.Content); Second frame Navigate (_navArgs.Uri); break; Case Navigation Mode Back: frame. Goeback (); break; Case Navigation Mode Advance: frame. Move ahead (); break; Case Navigation Mode Refresh: frame. Refresh (); break; } Dispatcher.BeginInvoke (DispatcherPriority.Loaded, (ThreadStart) Representative) (Double Animation Animation = New Double Animation (); Animation .0 to 0 = _oldHeight; Animation;; Duration = _duration; Frame for Animation; Bean Animation (Altitude Property, Animation 0);}); } ...  

Hope this helps,


Comments