BaconographyWP8.Common.ReorderListBox.OnApplyTemplate C# (CSharp) Method

OnApplyTemplate() public method

Applies the control template, gets required template parts, and hooks up the drag events.
public OnApplyTemplate ( ) : void
return void
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.scrollViewer = (ScrollViewer)this.GetTemplateChild(ReorderListBox.ScrollViewerPart);
            this.dragInterceptor = this.GetTemplateChild(ReorderListBox.DragInterceptorPart) as Canvas;
            this.dragIndicator = this.GetTemplateChild(ReorderListBox.DragIndicatorPart) as Image;
            this.rearrangeCanvas = this.GetTemplateChild(ReorderListBox.RearrangeCanvasPart) as Canvas;

            if (this.scrollViewer != null && this.dragInterceptor != null && this.dragIndicator != null)
            {
                this.dragInterceptor.Visibility = this.IsReorderEnabled ? Visibility.Visible : Visibility.Collapsed;

                this.dragInterceptor.ManipulationStarted += this.dragInterceptor_ManipulationStarted;
                this.dragInterceptor.ManipulationDelta += this.dragInterceptor_ManipulationDelta;
                this.dragInterceptor.ManipulationCompleted += this.dragInterceptor_ManipulationCompleted;
            }
        }