private static void ZoomOffsetChanged(FlexDocumentViewport i, DPChangedEventArgs <double> e)
 {
     FlexDocumentViewportSettings.Instance.Zoom = i.ZoomOffset;
     if (i.PART_scroll == null || i.PART_root == null)
     {
         i.applyZoomOffsetOnTemplate = true;
     }
     else
     {
         i.applyZoomOffsetOnTemplate = false;
         var centerOfViewport = new Point(i.PART_scroll.ViewportWidth / 2,
                                          i.PART_scroll.ViewportHeight / 2);
         i.lastCenterPositionOnTarget = i.PART_scroll.TranslatePoint(centerOfViewport, i.PART_root);
     }
 }
 private static void DocumentFileChanged(FlexDocumentViewport i, DPChangedEventArgs <FileInfo> e)
 {
     i.loadDocument(e.NewValue);
 }
 private static void DocumentChanged(FlexDocumentViewport i, DPChangedEventArgs <FlexDocument> e)
 {
     i.ZoomOffset = FlexDocumentViewportSettings.Instance.Zoom;
     i.RaiseEvent(new RoutedEventArgs(DocumentAddedEvent));
 }
		private static void DocumentFileChanged(FlexDocumentViewport i, DPChangedEventArgs<FileInfo> e)
		{
			i.loadDocument(e.NewValue);
		}
		private static void DocumentChanged(FlexDocumentViewport i, DPChangedEventArgs<FlexDocument> e)
		{
			i.ZoomOffset = FlexDocumentViewportSettings.Instance.Zoom;
			i.RaiseEvent(new RoutedEventArgs(DocumentAddedEvent));
		}
		private static void ZoomOffsetChanged(FlexDocumentViewport i, DPChangedEventArgs<double> e)
		{
			FlexDocumentViewportSettings.Instance.Zoom = i.ZoomOffset;
			if (i.PART_scroll == null || i.PART_root == null)
			{
				i.applyZoomOffsetOnTemplate = true;
			}
			else
			{
				i.applyZoomOffsetOnTemplate = false;
				var centerOfViewport = new Point(i.PART_scroll.ViewportWidth / 2,
																			 i.PART_scroll.ViewportHeight / 2);
				i.lastCenterPositionOnTarget = i.PART_scroll.TranslatePoint(centerOfViewport, i.PART_root);
			}
		}