Esempio n. 1
0
        internal static DesignerView GetDesignerView(DependencyObject visual)
        {
            DesignerView designerView = DesignerView.GetDesignerView(visual);

            while (designerView == null && visual != null)
            {
                visual = VisualTreeHelper.GetParent(visual);
                if (visual != null)
                {
                    designerView = DesignerView.GetDesignerView(visual);
                }
            }
            return(designerView);
        }
Esempio n. 2
0
 internal static Transform GetSelectionFrameTransformToParentVisual(ViewItem view, Visual ancestorView)
 {
     if (view != (ViewItem)null && (view.LayoutTransform == null || view.LayoutTransform == Transform.Identity))
     {
         Transform toImmediateParent    = TransformUtil.GetTransformToImmediateParent(view);
         Rect      selectionFrameBounds = view.SelectionFrameBounds;
         Vector    vector = new Vector(selectionFrameBounds.X, selectionFrameBounds.Y);
         Matrix    matrix = toImmediateParent.Value;
         matrix.Translate(vector.X, vector.Y);
         if ((view.VisualParent == (ViewItem)null ? (object)DesignerView.GetDesignerView((DependencyObject)ancestorView) : view.VisualParent.PlatformObject) != ancestorView)
         {
             Transform transformToAncestor = TransformUtil.GetParentTransformToAncestor(view, ancestorView);
             return((Transform) new MatrixTransform(matrix * transformToAncestor.Value));
         }
     }
     return(TransformUtil.GetTransformToAncestor(view, ancestorView));
 }