@@ -42,13 +42,22 @@ static Transitioner()
4242
4343 public static readonly DependencyProperty AutoApplyTransitionOriginsProperty = DependencyProperty . Register (
4444 "AutoApplyTransitionOrigins" , typeof ( bool ) , typeof ( Transitioner ) , new PropertyMetadata ( default ( bool ) ) ) ;
45-
45+
4646 public bool AutoApplyTransitionOrigins
4747 {
4848 get { return ( bool ) GetValue ( AutoApplyTransitionOriginsProperty ) ; }
4949 set { SetValue ( AutoApplyTransitionOriginsProperty , value ) ; }
5050 }
5151
52+ public static readonly DependencyProperty DefaultTransitionOriginProperty = DependencyProperty . Register (
53+ "DefaultTransitionOrigin" , typeof ( Point ) , typeof ( Transitioner ) , new PropertyMetadata ( new Point ( 0.5 , 0.5 ) ) ) ;
54+
55+ public Point DefaultTransitionOrigin
56+ {
57+ get { return ( Point ) GetValue ( DefaultTransitionOriginProperty ) ; }
58+ set { SetValue ( DefaultTransitionOriginProperty , value ) ; }
59+ }
60+
5261 public Transitioner ( )
5362 {
5463 CommandBindings . Add ( new CommandBinding ( MoveNextCommand , MoveNextHandler ) ) ;
@@ -189,12 +198,12 @@ private void ActivateFrame(int selectedIndex, int unselectedIndex)
189198 if ( oldSlide != null && newSlide != null )
190199 {
191200 var wipe = selectedIndex > unselectedIndex ? oldSlide . ForwardWipe : oldSlide . BackwardWipe ;
192- if ( wipe != null )
193- wipe . Wipe ( oldSlide , newSlide , _nextTransitionOrigin ?? new Point ( .5 , .5 ) , this ) ;
201+ if ( wipe != null )
202+ wipe . Wipe ( oldSlide , newSlide , GetTransitionOrigin ( newSlide ) , this ) ;
194203 else
195204 {
196- DoStack ( newSlide , oldSlide ) ;
197- oldSlide . Opacity = 0 ;
205+ DoStack ( newSlide , oldSlide ) ;
206+ oldSlide . Opacity = 0 ;
198207 }
199208 }
200209 else if ( oldSlide != null || newSlide != null )
@@ -209,6 +218,21 @@ private void ActivateFrame(int selectedIndex, int unselectedIndex)
209218 _nextTransitionOrigin = null ;
210219 }
211220
221+ private Point GetTransitionOrigin ( TransitionerSlide slide )
222+ {
223+ if ( _nextTransitionOrigin != null )
224+ {
225+ return _nextTransitionOrigin . Value ;
226+ }
227+
228+ if ( slide . ReadLocalValue ( TransitionerSlide . TransitionOriginProperty ) != DependencyProperty . UnsetValue )
229+ {
230+ return slide . TransitionOrigin ;
231+ }
232+
233+ return DefaultTransitionOrigin ;
234+ }
235+
212236 void IZIndexController . Stack ( params TransitionerSlide [ ] highestToLowest )
213237 {
214238 DoStack ( highestToLowest ) ;
0 commit comments