public override void OnApplyTemplate() { var timeSpan = new TimeSpan (0,0,0,1); m_first = GetTemplateChild ("REQUIRED_FOR_FIRST_ANIMATION") as PresentingSlideControl; m_second = GetTemplateChild ("REQUIRED_FOR_SECOND_ANIMATION") as PresentingSlideControl; if (m_first != null) { m_first.Opacity = 0; m_showFirstStoryboard = new Storyboard (); m_showFirstStoryboard.AnimateProperty ( m_first, OpacityProperty, timeSpan, 1.0 ); m_hideFirstStoryboard = new Storyboard (); m_hideFirstStoryboard.AnimateProperty ( m_first, OpacityProperty, timeSpan, 0.0 ); } if (m_second != null) { m_second.Opacity = 0; m_showSecondStoryboard = new Storyboard (); m_showSecondStoryboard.AnimateProperty ( m_second, OpacityProperty, timeSpan, 1.0 ); m_hideSecondStoryboard = new Storyboard (); m_hideSecondStoryboard.AnimateProperty ( m_second, OpacityProperty, timeSpan, 0.0 ); } base.OnApplyTemplate (); }
void ShowHideSlide( int i, PresentingSlideControl showPresenter, Storyboard hideStoryboard, Storyboard showStoryboard, State nextState ) { var currentIndex = Presentation.Slides.IndexOf (CurrentSlide); var nextIndex = currentIndex + i; if ( currentIndex < 0 || !nextIndex.Between (0, Presentation.Slides.Count - 1) ) { CurrentSlide = null; showPresenter.Slide = null; hideStoryboard.Begin (); m_state = i > 0 ? State.Finished : State.Start; } else { CurrentSlide = Presentation.Slides[nextIndex]; showPresenter.Slide = CurrentSlide; hideStoryboard.Begin (); showStoryboard.Begin (); m_state = nextState; } }