/// <summary> /// Called when a template has been applied to the control. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.mZoomAndPanControl = this.GetTemplateChild(PART_ZOOM_AND_PAN_CONTROL) as ZoomAndPanControl; this.mViewportOverview = this.GetTemplateChild(PART_VIEWPORT_OVERVIEW) as ViewportOverview; if (this.mZoomAndPanControl == null || this.mViewportOverview == null) { throw new Exception("OverviewControl control template not correctly defined."); } this.mZoomAndPanControl.SizeChanged += this.OnZoomAndPanControlSizeChanged; this.mViewportOverview.DragDelta += this.OnViewportOverviewDragDelta; }