1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
using MaterialDesignThemes.Wpf.Transitions;
namespace MaterialDesignThemes.Wpf.Transitions
{
/// <summary>
/// Content control to host the content of an individual page within a <see cref="Transitioner"/>.
/// </summary>
public class TransitionerSlide : TransitioningContentBase
{
static TransitionerSlide()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TransitionerSlide), new FrameworkPropertyMetadata(typeof(TransitionerSlide)));
}
public static readonly DependencyProperty TransitionOriginProperty = DependencyProperty.Register(
"TransitionOrigin", typeof(Point), typeof(Transitioner), new PropertyMetadata(new Point(0.5,0.5)));
public Point TransitionOrigin
{
get { return (Point)GetValue(TransitionOriginProperty); }
set { SetValue(TransitionOriginProperty, value); }
}
public static RoutedEvent InTransitionFinished =
EventManager.RegisterRoutedEvent("InTransitionFinished", RoutingStrategy.Bubble, typeof (RoutedEventHandler),
typeof (TransitionerSlide));
protected void OnInTransitionFinished(RoutedEventArgs e)
{
RaiseEvent(e);
}
public static readonly DependencyProperty StateProperty = DependencyProperty.Register("State", typeof (TransitionerSlideState), typeof (TransitionerSlide), new PropertyMetadata(default(TransitionerSlideState), new PropertyChangedCallback(StatePropertyChangedCallback)));
private static void StatePropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((TransitionerSlide) d).AnimateToState();
}
public TransitionerSlideState State
{
get { return (TransitionerSlideState) GetValue(StateProperty); }
set { SetValue(StateProperty, value); }
}
public static readonly DependencyProperty ForwardWipeProperty = DependencyProperty.Register(
"ForwardWipe", typeof (ITransitionWipe), typeof (TransitionerSlide), new PropertyMetadata(new CircleWipe()));
public ITransitionWipe ForwardWipe
{
get { return (ITransitionWipe) GetValue(ForwardWipeProperty); }
set { SetValue(ForwardWipeProperty, value); }
}
public static readonly DependencyProperty BackwardWipeProperty = DependencyProperty.Register(
"BackwardWipe", typeof (ITransitionWipe), typeof (TransitionerSlide), new PropertyMetadata(new SlideOutWipe()));
public ITransitionWipe BackwardWipe
{
get { return (ITransitionWipe) GetValue(BackwardWipeProperty); }
set { SetValue(BackwardWipeProperty, value); }
}
private void AnimateToState()
{
if (State != TransitionerSlideState.Current) return;
RunOpeningEffects();
}
}
}
|