Esempio n. 1
0
 public override void SetRootSize(BaseFrameworkElement root, Size size, bool setWidth, bool setHeight)
 {
     root.ViewModel.DefaultView.UpdateLayout();
     if (!root.ViewModel.IsInGridDesignMode && root is GridElement)
     {
         size = RoundingHelper.RoundSize(size);
         using (GridLayoutDesigner.TryCanvasDesignMode(root, size, setWidth, setHeight))
         {
             BaseFrameworkElement sizeElement = this.GetSizeElement(root);
             if (setHeight)
             {
                 sizeElement.Height = size.Height;
             }
             if (!setWidth)
             {
                 return;
             }
             sizeElement.Width = size.Width;
         }
     }
     else
     {
         base.SetRootSize(root, size, setWidth, setHeight);
     }
 }
Esempio n. 2
0
 public virtual void SetChildRect(BaseFrameworkElement child, Rect rect, LayoutOverrides layoutOverrides, LayoutOverrides overridesToIgnore, LayoutOverrides nonExplicitOverrides, SetRectMode setRectMode)
 {
     overridesToIgnore = this.AdjustOverrideToIgnore(child, overridesToIgnore);
     if (this.suppressLayoutRoundingCount == 0 && (LayoutRoundingHelper.GetLayoutRoundingStatus((SceneElement)child) & LayoutRoundingStatus.ShouldSnapToPixel) != LayoutRoundingStatus.Off)
     {
         rect = LayoutRoundingHelper.RoundRect(child.Platform.GeometryHelper, rect);
     }
     using (child.ViewModel.ScopeViewObjectCache())
     {
         using (GridLayoutDesigner.TryCanvasDesignMode(child, rect.Size, true, true))
         {
             LayoutUtilities.EnterLayoutMode();
             LayoutOperation layoutOperation = this.CreateLayoutOperation(child);
             if (layoutOverrides == LayoutOverrides.RecomputeDefault)
             {
                 layoutOverrides = this.InternalComputeOverrides(child, layoutOperation);
             }
             layoutOperation.SetRect(rect, layoutOverrides, overridesToIgnore, nonExplicitOverrides, setRectMode);
             LayoutUtilities.ExitLayoutMode();
         }
     }
 }