Example #1
0
        public FrameworkElementCapturer(WPFSceneView sceneView, Size targetSize)
            : base(targetSize)
        {
            Artboard         artboard         = sceneView.Artboard;
            FrameworkElement frameworkElement = (FrameworkElement)sceneView.DesignSurfaceRoot;
            SceneNode        viewRoot         = sceneView.ViewModel.ViewRoot;

            if (frameworkElement == null || viewRoot == null)
            {
                return;
            }
            this.element = frameworkElement;
            double?nullable1 = viewRoot.GetComputedValue(BaseFrameworkElement.WidthProperty) as double?;
            double?nullable2 = viewRoot.GetComputedValue(BaseFrameworkElement.HeightProperty) as double?;

            if (nullable1.HasValue && nullable2.HasValue && (!double.IsNaN(nullable1.Value) && !double.IsNaN(nullable2.Value)))
            {
                return;
            }
            Rect finalRect = new Rect(0.0, 0.0, 0.0, 0.0);

            artboard.Measure(finalRect.Size);
            artboard.Arrange(finalRect);
            artboard.UpdateLayout();
        }
Example #2
0
        private void SwapRootNameScopes(WPFSceneView parent)
        {
            if (parent == null)
            {
                return;
            }
            INameScope nameScope = this.rootNameScope;

            this.rootNameScope   = parent.rootNameScope;
            parent.rootNameScope = nameScope;
        }
Example #3
0
 public FrameworkElementCapturer(WPFSceneView sceneView)
     : this(sceneView, ImageCapturer.MaxSize)
 {
 }