public override void OnApplyTemplate()
        {
            if (this.mediaElement != null)
            {
                this.mediaElement.Loaded     -= this.Media_Loaded;
                this.mediaElement.MediaEnded -= this.MediaElement_MediaEnded;
            }

            if (this.playPauseButton != null)
            {
                this.playPauseButton.HoverClick -= this.PlayPauseButton_HoverClick;
            }

            base.OnApplyTemplate();

            this.mediaElement    = this.Template.FindName(Media, this) as MediaElement;
            this.playPauseButton = this.Template.FindName(PlayPauseButton, this) as HoverDwellButton;

            if (this.mediaElement != null)
            {
                this.mediaElement.Loaded     += this.Media_Loaded;
                this.mediaElement.MediaEnded += this.MediaElement_MediaEnded;
            }

            if (this.playPauseButton != null)
            {
                this.playPauseButton.HoverClick += this.PlayPauseButton_HoverClick;
            }
        }
        public override void OnApplyTemplate()
        {
            if (this.mediaElement != null)
            {
                this.mediaElement.Loaded -= this.Media_Loaded;
                this.mediaElement.MediaEnded -= this.MediaElement_MediaEnded;
            }

            if (this.playPauseButton != null)
            {
                this.playPauseButton.HoverClick -= this.PlayPauseButton_HoverClick;
            }

            base.OnApplyTemplate();

            this.mediaElement = this.Template.FindName(Media, this) as MediaElement;
            this.playPauseButton = this.Template.FindName(PlayPauseButton, this) as HoverDwellButton;

            if (this.mediaElement != null)
            {
                this.mediaElement.Loaded += this.Media_Loaded;
                this.mediaElement.MediaEnded += this.MediaElement_MediaEnded;
            }

            if (this.playPauseButton != null)
            {
                this.playPauseButton.HoverClick += this.PlayPauseButton_HoverClick;
            }
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.root = ((Microsoft.Samples.Kinect.BasicInteractions.StorySelectionControl)(target));
     return;
     case 2:
     this.MainGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.SubCategoryRow = ((System.Windows.Controls.RowDefinition)(target));
     return;
     case 4:
     this.TopRow = ((System.Windows.Controls.Grid)(target));
     return;
     case 5:
     this.HomeButton = ((Microsoft.Samples.Kinect.BasicInteractions.HoverDwellButton)(target));
     return;
     case 6:
     this.Subcategories = ((System.Windows.Controls.ItemsControl)(target));
     return;
     case 7:
     this.LeftScrollRegion = ((System.Windows.Controls.Grid)(target));
     return;
     case 8:
     this.RightScrollRegion = ((System.Windows.Controls.Grid)(target));
     return;
     case 9:
     this.ContentScrollViewer = ((System.Windows.Controls.ScrollViewer)(target));
     return;
     case 10:
     this.ContentItems = ((System.Windows.Controls.ItemsControl)(target));
     return;
     case 11:
     this.Story = ((Microsoft.Samples.Kinect.BasicInteractions.StoryControl)(target));
     return;
     }
     this._contentLoaded = true;
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.root = ((Microsoft.Samples.Kinect.BasicInteractions.StoryControl)(target));
     return;
     case 2:
     this.MainGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.BackButton = ((Microsoft.Samples.Kinect.BasicInteractions.HoverDwellButton)(target));
     return;
     case 4:
     this.HomeButton = ((Microsoft.Samples.Kinect.BasicInteractions.HoverDwellButton)(target));
     return;
     case 5:
     this.ContentScrollViewer = ((System.Windows.Controls.ScrollViewer)(target));
     return;
     case 6:
     this.StoryImage = ((System.Windows.Controls.Image)(target));
     return;
     case 7:
     this.UpScrollRegion = ((System.Windows.Controls.Grid)(target));
     return;
     case 8:
     this.DownScrollRegion = ((System.Windows.Controls.Grid)(target));
     return;
     }
     this._contentLoaded = true;
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.Exit = ((Microsoft.Samples.Kinect.BasicInteractions.HoverDwellButton)(target));
     
     #line 14 "..\..\StretchingActivity.xaml"
     this.Exit.HoverClick += new System.EventHandler<Microsoft.Samples.Kinect.BasicInteractions.HandInputEventArgs>(this.ExitActivity);
     
     #line default
     #line hidden
     return;
     case 2:
     this.Times = ((System.Windows.Controls.TextBox)(target));
     return;
     case 3:
     this.Selection = ((Microsoft.Samples.Kinect.BasicInteractions.HoverDwellButton)(target));
     
     #line 26 "..\..\StretchingActivity.xaml"
     this.Selection.HoverClick += new System.EventHandler<Microsoft.Samples.Kinect.BasicInteractions.HandInputEventArgs>(this.SelectionChosen);
     
     #line default
     #line hidden
     return;
     case 4:
     this.Correct = ((System.Windows.Controls.Image)(target));
     return;
     }
     this._contentLoaded = true;
 }